Help a novice: Will "sed" do?

Donn F Pedro donn at mcgp1.UUCP
Tue Jul 18 21:03:10 AEST 1989


In article <2180 at umbc3.UMBC.EDU> rostamia at 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 at Thalatta.COM   
           else:  {the known world}!uunet!nwnexus!thebes!mcgp1!donn 
       ----------------------------------------------------------------	
		You talk the talk.  Do you walk the walk?



More information about the Comp.unix.questions mailing list