🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #115

Re: What's wrong with this sed command?

#115
From: Glaze
Date: Thu, 23 Jul 1992 03:35
23 lines
1492 bytes
> I'm trying to use sed to trim off all leading "./" patterns from source
> filenames in make rules. On an IBM RS6000 the following works as I expected:

>    echo 'enquire.o: ./././enquire.c' | sed 's?: \(\./\)\{1,\}?: ?'
> yielding
>    enquire.o: enquire.c

> On our other systems (Sun-4, HP, SGI, and Motorola 68040) it prints
> different results. The HP doesn't trim any "./" patterns, while the Sun,
> Moto, and SGI all trim one pattern.

> Have I incorrectly specified the sed command or are one (or more) of the
> vendors' sed implementations incorrect? If so, which one(s)? I'm inclined to
> believe the IBM is correct and the others are bugged.

I'm inclined to believe the IBM is incorrect and most of the others are
correct. Your sed should be trying to match ONE pattern of the form
": ./"[blah]  and it does(on most machines) and replaces it. What you
want is for it to match multiple "./"s after the ": ", so try
    echo 'enquire.o: ./././enquire.c' | sed 's?: [\./]*?: ?'

> (I suppose this is another argument for perl...)
Could be.
Technical Details
Message-ID: <glaze.2520@glaze>
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!cs.mu.OZ.AU!glaze
References: <MONTNARO.92Jul21160321@ausable.crd.ge.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.unix.shell,comp.unix.questions
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!cs.mu.OZ.AU!glaze
From: glaze@cs.mu.oz.au (Glaze)
Subject: Re: What's wrong with this sed command?
Message-ID: <glaze.2520@glaze>
Sender: glaze@cs.mu.oz.au
Organization: Computer Science, University of Melbourne, Australia
References: <MONTNARO.92Jul21160321@ausable.crd.ge.com>
Date: Thu, 23 Jul 1992 03:35:20 GMT
Lines: 23