S Mathias <smathias1...@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?


What are your criteria? Matching "important" or "hello" somewhere in the
text? Something else? It's really not clear by your example what is to
be captured.

For example, if it's "important" or "hello" then personally I'd use
egrep and avoid the complexity of perl entirely:

    $ egrep 'important|hello' asdf.txt
    importantthing
    another important thing
    yet another thing
    hello!

    $ perl -ne '/important|hello/ && print' asdf.txt
    importantthing
    another important thing
    yet another thing
    hello!

Chris


-- 
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/dfebv7xbgl....@news.roaima.co.uk

Reply via email to