[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Sheflug] Thanks for awk-ward solutions



Hi Guys,

Many thanks for all the cool solutions to my awk problem 
(removing a recurring block of text from a file).  
The perl and awk ones produce identical great results 
(the sed one clearly only removes the 1st & last lines of 
the 25 line block.)  Here they are again:

perl -ne 'print unless /Cannot connect/../Graphics support/' testc.inp > testc.out
cat testc.inp | awk '/Cannot connect/,/Graphics support/{next};{print $0}' > testc.out
cat testc.inp | sed -e 's/Cannot connect//' | sed -e 's/Graphics support//' > testc.out

Maybe perl 'wins' for being 4 chars shorter than awk?  
My program loses bigtime for being about a dozen lines, 
tho it also removes the extra blank line at the end of each block.

Cheers,  Jan
-- 
        *****   Dr. Jan White   ***************************
        *       Molecular Biology, Sheffield University   *
        *       Phone: +44 114 222 2741  FAX: 272 8697    *
        *****   E-Mail: Jan.White [at] shef.ac.uk   ************
___________________________________________________________________

Sheffield Linux User's Group -
http://www.sheflug.co.uk/mailfaq.html

  GNU the choice of a complete generation.