Finding words in paragraphs

Bevis Ip ip at me.utoronto.ca
Tue Jul 18 07:26:53 AEST 1989


In article <10545 at smoke.BRL.MIL> gwyn at brl.arpa (Doug Gwyn) writes:
>In article <8421 at batcomputer.tn.cornell.edu> lacey at tcgould.tn.cornell.edu (John Lacey) writes:
>>Awk is what you want in this case.  Try something like this:
>>	awk 'BEGIN { FS = ""; RS = "\n"} /the-word-here/' the-filename-here

That is a problem.  But, Doug, I'm kind of surprised at the comment you made
in your last article though.  Try this, it is simplified from something that
I wrote to search bibliographies without having to use indxbib.  I haven't
check but I think the hold buffer in sed is dynamically expended, so paragraph
size might not be a problem in most implementations.

bevis

[ To the original poster:  I wasn't too careful when I cut my script to
	you; here's the correct one. ]

--------
#!/bin/sh
for i
do
	SEARCH="$SEARCH -e /$i/!b"
done
sed -n -e '/^$/b gotcha' -e H -e '$b gotcha' -e b \
	-e :gotcha -e x $SEARCH -e p
-- 
Bevis Ip                <>  ip at me.toronto.edu, ip at me.utoronto.ca
University of Toronto   <>  {pyramid,uunet}!utai!me!ip
Mechanical Engineering  <>  {allegra,decwrl}!utcsri!me!ip




More information about the Comp.unix.questions mailing list