Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 04 Sep 1998 09:44:04 -0400
From:      Roman Katsnelson <romank@graphnet.com>
To:        "q's" <freebsd-questions@FreeBSD.ORG>
Subject:   re: grep question
Message-ID:  <35EFEEA4.65B3315F@graphnet.com>

next in thread | raw e-mail | index | archive | help
Hi,

Thanks a lot to all for the suggestions and help offered, but I don't
think I explained my problem clearly enough. So I'll try again:

I have one text file with many records. Each record is 16 lines long.
The record's identifier is always the third line because it's unique.
The records look like this:

<blank line>
##################################
# --->uniquerecordname
##################################
recorddata 12 more lines worth.

I am writing a script which will automate deleting the records. Here's
what I've done:

grep -e "uniquerecordname" -A 13 -B 2 #this yields the record correctly.

however,

grep -e "uniquerecordname" -A 13 -B 2 -v #does NOT yield the inverse,
which should be the rest of the file without the record. 

i've tried outputting the grep result in the first example to a new
file, and then doing a diff on the two -- that works, but it puts a > in
the beginning of each line, which is unacceptable. 

Is there any other way to do this that I haven't thought of yet?

Thanks again,
Roman

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?35EFEEA4.65B3315F>