To remove some lines from a file

John Savage rookswood at suburbian.com.au
Sat Nov 4 22:03:44 EST 2006


Sebastian Busch <sebastian_busch at gmx.net> writes:
>The task is:
>
>"Remove the first two lines that don't begin with "@" from a file."
>
>How would you do it with sed?

Why a sed solution in a python group?

sed '/^@/!{G;/\n\n\n/{P;d;};s/[^\n]*//;h;d;}' data
-- 
John Savage                   (my news address is not valid for email)



More information about the Python-list mailing list