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!
j...@squeeje:~$ 


> 
> 
> how can i sovle this question? what is SOMEPERLMAGIC? are there any perl 
> gurus, that have a little spare time?


not a guru... I just love it... perl rules :)

joao


> 
> Thank you! :\
> 
> 
>       
> 
> 



-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/1294137620.2467.9.ca...@squeeje.critical.pt

Reply via email to