On Aug 16 2007 11:26, Mark Goldstein wrote:
>> >
>> > I would like to insert a new line on each second line, like that:
>>
>> Quick and easy;
>> for i in `cat pre.txt`; do echo -e "$i\n"; done >after.txt

That will not work, and for good. You should never-never-never use "for i in
`something`" for anything unless you know exactly what the outcome is. Because
by default, unless you muck with $IFS, it splits at word boundaries, not lines.

>> If that's all you want to do... If you do other sort of text
>> manipulation, have a look at sed.
>
>Or just use sed:
>
>cat your_file | sed G > new_file

perl -i -pe 's/\n/\n\n/' new_file



        Jan
-- 
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to