[c-nsp] return of the carriage

Phil Mayers p.mayers at imperial.ac.uk
Tue Mar 20 12:55:34 EST 2007


Allan, Andy J R wrote:
> I tried doing 
> sed -e "s/\n\t/,/g"
> but apparently command-line sed doesn't like tab characters, or there's
> not enough backslashes or something. Anyway, I got bored too quickly,
> otherwise I'd have done it in Perl by now.
> 
> Sam, where art thou?

Right tool for the right job:

awk 'NR==1 { print; next; } !p { p=$0; next; } { print p, $1; p=""; }'

20/03/2007
11:42 7
11:53 7
12:04 9

using sed will scrunch the first line (the date) in Jameys file all 
wrong, and anyway you used double quotes for the sed command which 
probably interpreted the backslash.


More information about the cisco-nsp mailing list