At 19:21 22/06/00, Lars Hecking wrote:
> I was going to post this under "Tip of the day", but then it came
> to me that others might enjoy a little food for their brain cells :)
>> The task: delete every other line in a text file. Naturally, I'm looking
> for a scriptable, small, and elegant solution. This probably excludes
> Word macros ...
perl -ne 'print if $a; $a = not $a' filename
or if you want the odd line
perl -ne 'print if not $a; $a = not $a' filename
Fergal
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!