Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!usc!jarthur!ssdbruce From: ssdbruce@jarthur.Claremont.EDU (Bruce Crabtree) Newsgroups: comp.unix.questions Subject: Re: Sed to make global replacements. Message-ID: <3369@jarthur.Claremont.EDU> Date: 2 Dec 89 03:10:19 GMT References: <37090@ames.arc.nasa.gov> Reply-To: ssdbruce@jarthur.UUCP (Bruce Crabtree) Organization: Software Systems Design, Claremont, CA Lines: 22 In article <37090@ames.arc.nasa.gov> gahooten@orion.arc.nasa.gov (Gregory A. Hooten) writes: >I would like to change the characters \(12 to 1/2, but every thing I try >thinks the \( is the start of a character group. Try sed 's/[\\](12/1\/2/g' By bracketing the backslash characters you are preventing sed from seeing the '\(' combination. Two backslashes are used since the backslash has special meaning to sed and must be escaped (with another backslash). The slash (or virgule, if you will) that is used to separate the '1/2' must also be escaped to prevent sed from using it as the delimiter of the substitution command. I added the 'g' or global option since I assume you might have multiple occurrances of \(12 on a line. Bruce Crabtree -- -------------------------------------------------------------------- Bruce Crabtree ssdbruce@jarthur.claremont.edu Software Systems Design, Inc [W] 1-714-624-2306 Claremont, CA [H] 1-714-738-6026