Article View: comp.unix.shell
Article #121Re: What's wrong with this sed command?
From: Harald.Eikrem
Date: Thu, 23 Jul 1992 19:22
Date: Thu, 23 Jul 1992 19:22
28 lines
1652 bytes
1652 bytes
John Mackin on `sed':
! What the original poster wants cannot be done in one step with the ed
! subset of regular expressions (as used by sed). If sed accepted full regular
! expressions, a la egrep, then the command would be:
!
! sed 's?: (\./)*?: ?' WRONG WRONG WRONG
You can do that with GNU sed. One more reason for everybody to rm /bin/sed
and install the GNU derived one..... :) The *only* drawback is that it
probably runs a bit slower.
! but since sed doesn't do full RE's, that won't work. You need
! another approach. Since you can't do it in one step, do it
! in several:
!
! sed -e ': loop' -e 's?: ./?: ?' -e 't loop'
I've always wondered why ":label; ....." was doomed to be unusable.
The way it is, I believe I may put it as
echo 'rubbish.o: ././././././rubbish.c' | /bin/sed ':;
s;: \./;: ;; t;'
for what it's worth :). (Hey, that's a non-csh continuation there, you do
remember to make that ....sed ':;\ before entering the 1.st newline in
csh/tcsh, dont you?).
~~harald E.
Technical Details
Message-ID:
<1992Jul23.192253*Harald.Eikrem@delab.sintef.no>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!sunic!aun.uninett.no!ugle.unit.no!newsReferences:
<MONTNARO.92Jul21160321@ausable.crd.ge.com> <glaze.2520@glaze> <1992Jul23.090023.17661@physiol.su.OZ.AU>Show Full Headers
Complete Article Headers
Newsgroups: comp.unix.shell,comp.unix.questions Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sunic!aun.uninett.no!ugle.unit.no!news From: Harald.Eikrem@delab.sintef.no Subject: Re: What's wrong with this sed command? In-Reply-To: john@physiol.su.OZ.AU (John Mackin) Message-ID: <1992Jul23.192253*Harald.Eikrem@delab.sintef.no> Keywords: sed' too much Sender: news@ugle.unit.no (NetNews Administrator) Organization: SINTEF DELAB, Trondheim, Norway. References: <MONTNARO.92Jul21160321@ausable.crd.ge.com> <glaze.2520@glaze> <1992Jul23.090023.17661@physiol.su.OZ.AU> Date: 23 Jul 92 19:22:52 Lines: 28