On Wed, May 24, 2000 at 11:25:27AM +0100, John P. Looney (Kate) wrote:
> I've a file that for some reason a windows editor has put in double
> newlines everywhere.
>> Anyone got a good way of getting rid of them ? I tryed:
>> cat file | tr -s \\n
>> and
>> cat file | sed -e 's/\n\n/\n'
I've just realised that my earlier answer could have been shorter and
perlier - I'll be drummed out of Perl-mongers :-). This works nicely
perl -lne 'print if length' screwed_up_file
Regards,
Niall
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!