Sed to make global replacements.

Conor P. Cahill cpcahil at virtech.uucp
Mon Dec 4 01:13:36 AEST 1989


In article <5306 at omepd.UUCP>, merlyn at iwarp.intel.com (Randal Schwartz) writes:
> In article <37090 at ames.arc.nasa.gov>, gahooten at 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     |
+-----------------------------------------------------------------------+



More information about the Comp.unix.questions mailing list