home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / unix / shell / 5457 < prev    next >
Encoding:
Text File  |  1993-01-21  |  874 b   |  29 lines

  1. Newsgroups: comp.unix.shell
  2. Path: sparky!uunet!cs.utexas.edu!sun-barr!ames!agate!rsoft!mindlink!a3358
  3. From: Ian_Staines@mindlink.bc.ca (Ian Staines)
  4. Subject: multiple sub's with 'sed'
  5. Organization: MIND LINK! - British Columbia, Canada
  6. Date: Fri, 22 Jan 1993 04:39:26 GMT
  7. Message-ID: <19891@mindlink.bc.ca>
  8. Sender: news@deep.rsoft.bc.ca (Usenet)
  9. Lines: 18
  10.  
  11. sed novice seeks help (sed man page is greek to me)
  12.  
  13. How can I get 'sed' to do multiple substitutions?  I would like to replace
  14. certain words in a text file with bold type.  I have tried the following:
  15.  
  16. for WORD in ${LIST}
  17. do
  18.         BOLD="${bold}${WORD}${unbold}"
  19.         sed "/s/${WORD}/${BOLD}/gw ${FILE}" ${FILE}
  20. done
  21.  
  22. The shell appears to keep ${FILE} intact within the script, and does not
  23. updated it with each loop.  I only get the last substitution, not the entire
  24. list.
  25.  
  26. Is there a way to loop within sed?
  27.  
  28.  
  29.