a perl question
krad
kraduk at gmail.com
Tue Jan 4 13:06:10 UTC 2011
On 4 January 2011 10:32, S Mathias <smathias1972 at yahoo.com> 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!
>
>
> how can i sovle this question? what is SOMEPERLMAGIC? are there any perl
> gurus, that have a little spare time?
>
> Thank you! :\
>
>
>
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "
> freebsd-questions-unsubscribe at freebsd.org"
>
doesnt need to be perl either
cat asdf.txt | awk 'BEGIN {a=0} { if ( $0 ~ /\[XYZ\]/ ) a=1; if ( $0 ~
/\[\/XYZ\]/ ) a=0; if ( a == 1) print $0}'
or something close to it
More information about the freebsd-questions
mailing list