one more SED/AWK question

S. Luke Jones slj at mtung.ATT.COM
Wed Dec 7 22:32:03 AEST 1988


I think I provided too much detail in my previous posting.  Let's assume
we have a text file
	blah blah SUDAN  blah
	blah blah CZECHOSLOVAKIA  blah
	blah blah MALAYSIA  blah
	blah blah CANADA  blah
	blah blah PERU  blah
Suppose I want to grab everything between CZECHOSLOVAKIA to PERU, not
counting PERU.  I *don't* know anything about the order of countries
in this file and I *don't* know that CANADA is the line before PERU.

	sed -n '/CZECH/,/PERU/p'

gives me what I want except it includes the line with PERU.  By
contrast,

	awk '/CZECH/,/PERU/'

prints precisely the lines I want, i.e., it does not include PERU.

Any suggestions?
-- 
                                                  S. Luke Jones
                                       AT&T Infor#####Bell Labs
        200 Laurel Avenue, Room MT 2E-337, Middletown, NJ 07748
    slj at mtung.att.com  -or-  ...!att!mtung!slj   (201)-957-2733



More information about the Comp.unix.questions mailing list