Newsgroups: comp.unix.questions Path: utzoo!utgpu!radio.astro!me!ip From: ip@me.utoronto.ca (Bevis Ip) Subject: Re: Finding words in paragraphs Message-ID: <89Jul17.172655edt.19593@me.utoronto.ca> Organization: University of Toronto Mechanical Engineering References: <8421@batcomputer.tn.cornell.edu> <10545@smoke.BRL.MIL> Date: Mon, 17 Jul 89 17:26:53 EDT In article <10545@smoke.BRL.MIL> gwyn@brl.arpa (Doug Gwyn) writes: >In article <8421@batcomputer.tn.cornell.edu> lacey@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@me.toronto.edu, ip@me.utoronto.ca University of Toronto <> {pyramid,uunet}!utai!me!ip Mechanical Engineering <> {allegra,decwrl}!utcsri!me!ip