home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / shell / 3097 < prev    next >
Encoding:
Internet Message Format  |  1992-07-22  |  1.5 KB

  1. Xref: sparky comp.unix.shell:3097 comp.unix.questions:9322
  2. Newsgroups: comp.unix.shell,comp.unix.questions
  3. Path: sparky!uunet!munnari.oz.au!cs.mu.OZ.AU!glaze
  4. From: glaze@cs.mu.oz.au (Glaze)
  5. Subject: Re: What's wrong with this sed command?
  6. Message-ID: <glaze.2520@glaze>
  7. Sender: glaze@cs.mu.oz.au
  8. Organization: Computer Science, University of Melbourne, Australia
  9. References: <MONTNARO.92Jul21160321@ausable.crd.ge.com>
  10. Date: Thu, 23 Jul 1992 03:35:20 GMT
  11. Lines: 23
  12.  
  13. > I'm trying to use sed to trim off all leading "./" patterns from source
  14. > filenames in make rules. On an IBM RS6000 the following works as I expected:
  15.  
  16. >    echo 'enquire.o: ./././enquire.c' | sed 's?: \(\./\)\{1,\}?: ?'
  17. > yielding
  18. >    enquire.o: enquire.c
  19.  
  20. > On our other systems (Sun-4, HP, SGI, and Motorola 68040) it prints
  21. > different results. The HP doesn't trim any "./" patterns, while the Sun,
  22. > Moto, and SGI all trim one pattern.
  23.  
  24. > Have I incorrectly specified the sed command or are one (or more) of the
  25. > vendors' sed implementations incorrect? If so, which one(s)? I'm inclined to
  26. > believe the IBM is correct and the others are bugged.
  27.  
  28. I'm inclined to believe the IBM is incorrect and most of the others are
  29. correct. Your sed should be trying to match ONE pattern of the form
  30. ": ./"[blah]  and it does(on most machines) and replaces it. What you
  31. want is for it to match multiple "./"s after the ": ", so try
  32.     echo 'enquire.o: ./././enquire.c' | sed 's?: [\./]*?: ?'
  33.  
  34. > (I suppose this is another argument for perl...)
  35. Could be.
  36.