On Tue, 2011-01-04 at 22:05 +1100, Karl Auer wrote:
> > $ SOMEPERLMAGIC asdf.txt > output.txt
> > how can i sovle this question? what is SOMEPERLMAGIC? are there any
> perl gurus, that have a little spare time?
>
> It's not clear from your "sample data" what it is you are trying to
> do.
> What distinguishes the lines you want to keep from the lines you want
> to
> discard?
from [XYZ] line to [/XYZ] line

... I guess !
solution:
jmf@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
jmf@squeeje:~$
jmf@squeeje:~$
jmf@squeeje:~$
jmf@squeeje:~$
jmf@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!
jmf@squeeje:~$
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users