Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Sep 1998 11:18:37 -0500
From:      Dan Nelson <dnelson@emsphone.com>
To:        Roman Katsnelson <romank@graphnet.com>
Cc:        "q's" <freebsd-questions@FreeBSD.ORG>
Subject:   Re: grep question
Message-ID:  <19980904111837.A8446@emsphone.com>
In-Reply-To: <35F01196.BA6A7F7F@graphnet.com>; from "Roman Katsnelson" on Fri Sep  4 12:13:10 GMT 1998
References:  <35EFEEA4.65B3315F@graphnet.com> <19980904095358.A7658@emsphone.com> <35F01196.BA6A7F7F@graphnet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980904111837.A8446>