hpux ksh: insert hard return after string

Watnog
Watnog used Ask the Experts™
on
Hi Experts,

I have this file on hpux:

 
...

Sun May 20 11:11:39 EDT 2012: 13
Sun May 20 11:16:39 EDT 2012: 10
Sun May 20 11:21:21 EDT 2012: 9
Sun May 20 11:26:21 EDT 2012: 9
Sun May 20 11:31:24 EDT 2012: 11
Sun May 20 11:36:25 EDT 2012: 13
Sun May 20 11:41:26 EDT 2012: 14
Sun May 20 11:46:27 EDT 2012: 14
Sun May 20 11:51:28 EDT 2012: 12
Sun May 20 11:56:32 EDT 2012: 12
Sun May 20 12:01:37 EDT 2012: 12
Sun May 20 12:06:38 EDT 2012: 9
Sun May 20 12:11:20 EDT 2012: 13
Sun May 20 12:16:23 EDT 2012: 14
Sun May 20 12:21:28 EDT 2012: 13
Sun May 20 12:26:31 EDT 2012: 10
Sun May 20 12:31:35 EDT 2012: 10
Sun May 20 12:36:34 EDT 2012: 1
Sun May 20 12:41:37 EDT 2012Sun May 20 12:46:20 EDT 2012: 6
Sun May 20 12:51:21 EDT 2012: 3
Sun May 20 10:56:28 EDT 2012: 9
Sun May 20 11:01:31 EDT 2012: 9
Sun May 20 11:06:37 EDT 2012: 11
Sun May 20 11:11:39 EDT 2012: 13
Sun May 20 11:16:39 EDT 2012: 10
Sun May 20 11:21:21 EDT 2012: 9
Sun May 20 11:26:21 EDT 2012: 9
Sun May 20 11:31:24 EDT 2012: 11
Sun May 20 11:36:25 EDT 2012: 13
Sun May 20 11:41:26 EDT 2012: 14
Sun May 20 11:46:27 EDT 2012: 14
Sun May 20 11:51:28 EDT 2012: 12
Sun May 20 11:56:32 EDT 2012: 12
Sun May 20 12:01:37 EDT 2012: 12
Sun May 20 12:06:38 EDT 2012: 9
Sun May 20 12:11:20 EDT 2012: 13
Sun May 20 12:16:23 EDT 2012: 14
Sun May 20 12:21:28 EDT 2012: 13
Sun May 20 12:26:31 EDT 2012: 10
Sun May 20 12:31:35 EDT 2012: 10
Sun May 20 12:36:34 EDT 2012: 1
Sun May 20 12:41:37 EDT 2012Sun May 20 12:46:20 EDT 2012: 6
Sun May 20 12:51:21 EDT 2012: 3
Sun May 20 12:56:24 EDT 2012: 3
Sun May 20 13:01:27 EDT 2012Sun May 20 13:06:29 EDT 2012Sun May 20 13:11:31 EDT 2012Sun May 20 13:16:34 EDT 2012Sun May 20 13:
21:34 EDT 2012Sun May 20 13:26:35 EDT 2012Sun May 20 13:31:36 EDT 2012Sun May 20 13:36:39 EDT 2012Sun May 20 13:41:23 EDT 2012
Sun May 20 13:46:26 EDT 2012Sun May 20 13:51:28 EDT 2012Sun May 20 13:56:31 EDT 2012Sun May 20 14:01:32 EDT 2012Sun May 20 14:
06:36 EDT 2012Sun May 20 14:11:38 EDT 2012Sun May 20 14:16:39 EDT 2012Sun May 20 14:21:22 EDT 2012Sun May 20 14:26:25 EDT 2012
Sun May 20 14:31:27 EDT 2012Sun May 20 14:36:30 EDT 2012Sun May 20 14:41:33 EDT 2012Sun May 20 14:46:34 EDT 2012Sun May 20 14:
51:37 EDT 2012Sun May 20 14:56:38 EDT 2012Sun May 20 15:01:21 EDT 2012Sun May 20 15:06:24 EDT 2012Sun May 20 15:11:25 EDT 2012
Sun May 20 15:16:28 EDT 2012Sun May 20 15:21:28 EDT 2012Sun May 20 15:26:30 EDT 2012Sun May 20 15:31:33 EDT 2012Sun May 20 15:
36:33 EDT 2012Sun May 20 15:41:35 EDT 2012Sun May 20 15:46:38 EDT 2012Sun May 20 15:51:21 EDT 2012Sun May 20 15:56:24 EDT 2012
Sun May 20 16:01:24 EDT 2012Sun May 20 16:06:27 EDT 2012Sun May 20 16:11:28 EDT 2012Sun May 20 16:16:32 EDT 2012Sun May 20 16:
21:34 EDT 2012Sun May 20 16:26:35 EDT 2012Sun May 20 16:31:37 EDT 2012Sun May 20 16:36:37 EDT 2012Sun May 20 16:41:39 EDT 2012
Sun May 20 16:46:39 EDT 2012Sun May 20 16:51:40 EDT 2012Sun May 20 16:56:22 EDT 2012Sun May 20 17:01:23 EDT 2012Sun May 20 17:
06:26 EDT 2012Sun May 20 17:11:28 EDT 2012Sun May 20 17:16:31 EDT 2012Sun May 20 17:21:36 EDT 2012Sun May 20 17:26:37 EDT 2012
Sun May 20 17:31:39 EDT 2012Sun May 20 17:36:23 EDT 2012Sun May 20 17:41:25 EDT 2012Sun May 20 17:46:25 EDT 2012Sun May 20 17:
51:26 EDT 2012Sun May 20 17:56:27 EDT 2012Sun May 20 18:01:29 EDT 2012Sun May 20 18:06:31 EDT 2012Sun May 20 18:11:34 EDT 2012
Sun May 20 18:16:35 EDT 2012Sun May 20 18:21:37 EDT 2012Sun May 20 18:26:39 EDT 2012Sun May 20 18:31:20 EDT 2012Sun May 20 18:
36:22 EDT 2012Sun May 20 18:41:25 EDT 2012Sun May 20 18:46:27 EDT 2012Sun May 20 18:51:28 EDT 2012Sun May 20 18:56:31 EDT 2012
Sun May 20 19:01:31 EDT 2012Sun May 20 19:06:33 EDT 2012Sun May 20 19:11:36 EDT 2012Sun May 20 19:16:36 EDT 2012Sun May 20 19:
21:37 EDT 2012: 8
Sun May 20 19:26:39 EDT 2012: 34
Sun May 20 19:31:20 EDT 2012: 23
Sun May 20 19:36:23 EDT 2012: 18
Sun May 20 19:31:20 EDT 2012: 23
Sun May 20 19:36:23 EDT 2012: 18
Sun May 20 19:41:23 EDT 2012: 17
Sun May 20 19:46:25 EDT 2012: 17
Sun May 20 19:51:28 EDT 2012: 18
Sun May 20 19:56:32 EDT 2012: 12
Sun May 20 20:01:32 EDT 2012: 21
Sun May 20 20:06:33 EDT 2012: 17
Sun May 20 20:11:34 EDT 2012: 15
Sun May 20 20:16:34 EDT 2012: 16
Sun May 20 20:21:35 EDT 2012: 11
Sun May 20 20:26:35 EDT 2012: 13
Sun May 20 20:31:36 EDT 2012: 1
...

Open in new window


Problem is with the date stamp not followed by a semicolon and a number (in fact a zero).
I need something to replace the [2012 not followed by a semicolon] by a hard return.

Can you help here?
Thanks.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2013
Top Expert 2013
Commented:
sed 's/2012\([A-z0-9]\)/2012@\1/g' inputfile |tr "@" "\n"

Please note that the above inserts a "newline", not a "carriage return".

If a carriage return is desired replace "\n" with "\r"

If you suspect that the intermediate character "@" used above could appear in the input file choose a different one.

Author

Commented:
It has been some time wmp.
Very good. Thank you.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial