On Tue, Jan 4, 2011 at 11:40 AM, Joao Ferreira gmail <[email protected]> wrote: > On Tue, 2011-01-04 at 02:27 -0800, S Mathias wrote: >> cat asdf.txt >> bla-bla >> bla-bla >> bla[XYZ] >> importantthing >> another important thing >> [/XYZ] >> bla-bla >> bla-bla >> [XYZ] >> yet another thing >> hello! >> [/XYZ] >> bla-bla >> etc. >> $ SOMEPERLMAGIC asdf.txt > output.txt >> $ cat output.txt >> importantthing >> another important thing >> yet another thing >> hello! > > > j...@squeeje:~$ cat asdf.txt > bla-bla > bla-bla > bla[XYZ] > importantthing > another important thing > [/XYZ] > bla-bla > bla-bla > [XYZ] > yet another thing > hello! > [/XYZ] > bla-bla > > j...@squeeje:~$ > j...@squeeje:~$ > j...@squeeje:~$ > j...@squeeje:~$ > j...@squeeje:~$ cat asdf.txt | perl -e 'my $important =0; while (<>) {if > (/\[XYZ\]/) {$important = 1;next;}; if (/\[\/XYZ\]/){$important=0;next}; > if ($important) {print;}};' > importantthing > another important thing > yet another thing > hello!
Or use ".." range operator: perl -ne 'print if (/\[XYZ\]/../\[\/XYZ\]/ and not /\[\/?XYZ\]/)' PD: Should I add "OT: " to subject , or is it not ok doing that when thread is started?? -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected] Archive: http://lists.debian.org/[email protected]

