From owner-freebsd-questions Fri Sep 4 09:19:51 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id JAA14487 for freebsd-questions-outgoing; Fri, 4 Sep 1998 09:19:51 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id JAA14482 for ; Fri, 4 Sep 1998 09:19:46 -0700 (PDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.9.1/8.9.1) id LAA08819; Fri, 4 Sep 1998 11:18:37 -0500 (CDT) Message-ID: <19980904111837.A8446@emsphone.com> Date: Fri, 4 Sep 1998 11:18:37 -0500 From: Dan Nelson To: Roman Katsnelson Cc: "q's" Subject: Re: grep question References: <35EFEEA4.65B3315F@graphnet.com> <19980904095358.A7658@emsphone.com> <35F01196.BA6A7F7F@graphnet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.94.2i In-Reply-To: <35F01196.BA6A7F7F@graphnet.com>; from "Roman Katsnelson" on Fri Sep 4 12:13:10 GMT 1998 X-OS: FreeBSD 2.2.7-STABLE Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In the last episode (Sep 04), Roman Katsnelson said: > > # delete the offending record > > sed -e "${start}-${end}d" < $file > $file.tmp > > Thank you! > When I test this on an actual record, though, > it returns: > > sed: 1: "270-285d": invalid command code - > > any ideas? > > btw, what's a good book on sed and awk and sh etc.? Oops.. That's a typo. the sed line should read sed -e "${start},${end}d" < $file > $file.tmp i.e. a "," instead of a "-". I believe there are O'Reilly books on both sed and awk. Awk is good for field-based processing (summing columns, etc), and sed is good for line-based processing. I just read the man pages, and hope for the best :) -Dan To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message