Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uunet!aplcen!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!usc!jarthur!ssdbruce From: ssdbruce@jarthur.Claremont.EDU (Bruce Crabtree) Newsgroups: comp.unix.questions Subject: Re: Sed to make global replacements. Keywords: sed, escape sequence Message-ID: <3371@jarthur.Claremont.EDU> Date: 2 Dec 89 03:18:49 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' The brackets ('[]') are used to prevent sed from seeing the '\(' character combination and interpreting them as such. Two backslashes are used since the backslash must be escaped in sed. The slash or virgule in the '1/2' must also be escaped since sed would take it to be the delimiter of the substitute command. I've added the 'g' or global option since I assume you might have more than one instance of \(12 per 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