From owner-freebsd-questions Fri Sep 4 06:37:48 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id GAA21717 for freebsd-questions-outgoing; Fri, 4 Sep 1998 06:37:48 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from netra.graphnet.com (netra.graphnet.com [192.206.112.2]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id GAA21711 for ; Fri, 4 Sep 1998 06:37:46 -0700 (PDT) (envelope-from romank@graphnet.com) Received: from graphnet.com (roman.graphnet.com [192.206.112.93]) by netra.graphnet.com (8.8.8/8.8.6) with ESMTP id JAA28279 for ; Fri, 4 Sep 1998 09:36:40 -0400 (EDT) Message-ID: <35EFEEA4.65B3315F@graphnet.com> Date: Fri, 04 Sep 1998 09:44:04 -0400 From: Roman Katsnelson Organization: Graphnet, Inc X-Mailer: Mozilla 4.05 [en] (WinNT; U) MIME-Version: 1.0 To: "q's" Subject: re: grep question Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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: ################################## # --->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