Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!ccu.umanitoba.ca!herald.usask.ca!alberta!aunro!lll-winken!uunet!mcsun!ukc!pyrltd!root44!gwc From: gwc@root.co.uk (Geoff Clare) Newsgroups: comp.editors Subject: Re: Multiple line regexps Keywords: regexp, multiple lines Message-ID: <2732@root44.co.uk> Date: 6 Jun 91 13:28:28 GMT References: <1991Jun2.231351.10229@trl.oz.au> <1991Jun03.045458.4972@convex.com> Distribution: comp Organization: UniSoft Ltd., London, England Lines: 18 tchrist@convex.COM (Tom Christiansen) writes: > 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. The exact equivalent in awk is: awk 'BEGIN { RS=""; FS="\n" } { print $1 }' some_file The RS="" makes blank lines the record separator, and the FS="\n" allows the first line of the record to be obtained using "$1". -- Geoff Clare (Dumb American mailers: ...!uunet!root.co.uk!gwc) UniSoft Limited, London, England. Tel: +44 71 729 3773 Fax: +44 71 729 3273