Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!usc!cs.utexas.edu!uunet!pilchuck!ssc!mcgp1!donn From: donn@mcgp1.UUCP (Donn F Pedro) Newsgroups: comp.unix.questions Subject: Re: Help a novice: Will "sed" do? Message-ID: <1985@mcgp1.UUCP> Date: 18 Jul 89 11:03:10 GMT References: <2180@umbc3.UMBC.EDU> <10540@smoke.BRL.MIL> Reply-To: donn@mcgp1.UUCP (Donn F Pedro) Organization: THE WAR ROOM on Elliot Bay. Lines: 24 In article <2180@umbc3.UMBC.EDU> rostamia@umbc3.UMBC.EDU (Dr. Rouben Rostamian) writes: >I need a command or a script that searches a text file for a given >word or pattern and prints out all paragraphs that contain that word >or pattern. Paragraphs are blocks of text separated by one or >more blank lines. Try this: nawk ' BEGIN { RS="" ORS="\n\n" } /pattern/ ' file Works for me on: UNIX system V release 3.1.1 Donn F Pedro ....................a.k.a. mcgp1!donn@Thalatta.COM else: {the known world}!uunet!nwnexus!thebes!mcgp1!donn ---------------------------------------------------------------- You talk the talk. Do you walk the walk?