[TriLUG] vi or sed or perl question - joining lines
Craig Taylor
ctalkobt at gmail.com
Fri Jun 1 14:33:47 EDT 2007
Awk is your friend...
cat tmp.txt | awk '{ line=$0;if( NR % 12 == 0 ) print line; else printf
"%s",substr( line, 0,length(line)+1 ); }'
(Note: I tried the same thing with gsub but couldn't get it to work.. )
On 6/1/07, Mike Norwood <norwoodm at earthlink.net> wrote:
>
>
> Hello,
>
> I have a big goofy text file I need to get into a more usable format.
> Basically what I need to do is join every 12 lines into 1 line, down
> through the entire file. Does anyone have a good suggestion on how to do
> this? I know that I must have done this same thing 2 years ago, because I
> found an earlier version of this same data from May 2005 that I somehow
> converted, but I now have no idea how it was done.
>
> Thanks, Mike
>
> --
> TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug
> TriLUG Organizational FAQ : http://trilug.org/faq/
> TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
>
More information about the TriLUG
mailing list