Path: utzoo!attcan!uunet!virtech!cpcahil From: cpcahil@virtech.uucp (Conor P. Cahill) Newsgroups: comp.unix.questions Subject: Re: Sed to make global replacements. Message-ID: <1989Dec3.141336.27475@virtech.uucp> Date: 3 Dec 89 14:13:36 GMT References: <37090@ames.arc.nasa.gov> <5306@omepd.UUCP> Organization: Virtual Technologies Inc. Lines: 22 In article <5306@omepd.UUCP>, merlyn@iwarp.intel.com (Randal Schwartz) writes: > In article <37090@ames.arc.nasa.gov>, gahooten@orion (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. I would like any help > | possible on this problem. > > Now, with Perl (of course, you knew it was coming :-), if you had a > whole directory full of these files, you could perform this > substitution, saving the original files as filename.bak, with: > > % perl -p -i.bak -e 's,\\(12,1/2,g;' * First, you forgot an extra \ for the (. Second, this silently deletes the original files if the filename is too long on a system V system. -- +-----------------------------------------------------------------------+ | Conor P. Cahill uunet!virtech!cpcahil 703-430-9247 ! | Virtual Technologies Inc., P. O. Box 876, Sterling, VA 22170 | +-----------------------------------------------------------------------+