Article View: comp.editors
Article #2747Re: Multiple line regexps
From: Tom Christiansen
Date: Mon, 03 Jun 1991 04:54
Date: Mon, 03 Jun 1991 04:54
17 lines
1222 bytes
1222 bytes
From the keyboard of soh@andromeda.trl.OZ.AU (kam hung soh):
:I would like to write a regular expression which can look for patterns
:longer than one line. For example, I want to find the first line of
:each paragraph.
It occurs to me I didn't answer the example question. In perl, you
could solve that problem in this way (and many others as well):
perl -00 -ne 'print /(.*\n)/' some_file
The -00 put us in paragraph mode, and the (.*\n) isolates the first
line of each paragraph for printing.
--tom
--
Tom Christiansen tchrist@convex.com convex!tchrist
"Perl is to sed as C is to assembly language." -me
Technical Details
Message-ID:
<1991Jun03.045458.4972@convex.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!convex!usenetReferences:
<1991Jun2.231351.10229@trl.oz.au>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!convex!usenet From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.editors Subject: Re: Multiple line regexps Keywords: regexp, multiple lines Message-ID: <1991Jun03.045458.4972@convex.com> Date: 3 Jun 91 04:54:58 GMT References: <1991Jun2.231351.10229@trl.oz.au> Sender: usenet@convex.com (news access account) Reply-To: tchrist@convex.COM (Tom Christiansen) Distribution: comp Organization: CONVEX Software Development, Richardson, TX Lines: 17 Nntp-Posting-Host: pixel.convex.com