home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.unix.shell:3097 comp.unix.questions:9322
- Newsgroups: comp.unix.shell,comp.unix.questions
- Path: 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
-
- > 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.
-