Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Jan 2011 13:06:07 +0000
From:      krad <kraduk@gmail.com>
To:        S Mathias <smathias1972@yahoo.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: a perl question
Message-ID:  <AANLkTinEksoXQAA4ZAziE59h%2BLRTxSgSy2WZy6UaQne%2B@mail.gmail.com>
In-Reply-To: <117654.42578.qm@web121409.mail.ne1.yahoo.com>
References:  <117654.42578.qm@web121409.mail.ne1.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 4 January 2011 10:32, S Mathias <smathias1972@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@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "
> freebsd-questions-unsubscribe@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTinEksoXQAA4ZAziE59h%2BLRTxSgSy2WZy6UaQne%2B>