[X-Unix] Any CLI multi-line regex find utilities out there?

David Ledger dledger at ivdcs.demon.co.uk
Wed Oct 27 10:32:08 PDT 2004


>From: Jakob Peterh?nsel <jakob at hjemme.dk>
>I though grep could do it, as BBEdit's version can, but got
>disappointed. Grep can't find over multi-lines...
>
>So, is there any CLI solutions out there that can return a match on
>text over multi lines???
>
>I would like to do something like:
>
>echo 'my very long text from a email body' | myRegexCmd 'regex
>expression'

In a word or three, - sed or perl.

Perl is probably easier because the quoting can be easier.

sed -n 'g/multi line pattern/p'

will do it in sed.  Generating the pattern is a excercise for the reader :-)

David


-- 
David Ledger - Freelance Unix Sysadmin in the UK.
Chair of HPUX SysAdmin SIG of hpUG technical user group (www.hpug.org.uk)
dledger at ivdcs.co.uk
www.ivdcs.co.uk


More information about the X-Unix mailing list