[clug] Two (perhaps simple) shell questions.
Robert Thorsby
robert at thorsby.com.au
Mon Aug 17 19:50:36 MDT 2009
On 18/08/09 11:33:01, Andrew Janke wrote:
> 1) I had a need (really) to remove every second newline from a file
> the other day and all I could think of was this:
<snip>
If you are trying to convert two intervening blank lines into one blank
line, try:
awk 'BEGIN{RS="\n\n"}{print($0)}' input.file > output.file
However, if you wish to halve the number of lines (regardless of their
content) just print odd (or even) lines.
HTH,
Robert Thorsby
Know your enemies well because that's the only way you are going to
defeat them. And know your friends even better just in case they become
your enemies.
More information about the linux
mailing list