Sed to make global replacements.

Randal Schwartz merlyn at iwarp.intel.com
Mon Dec 4 10:36:39 AEST 1989


In article <1989Dec3.141336.27475 at virtech.uucp>, cpcahil at virtech (Conor P. Cahill) writes:
| > 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.

I won't argue about System V.  No point.  It's brain-damaged.

However, shame on me for forgetting that Perl makes left-paren a magic
char!

Larry, can you ever forgive me?  Speak to me Larry!  We got another
200 pages to write for the book!  Larry!  Larry???!!

(I guess Larry is going to have to proofread my code pretty thoroughly
from now on...)

Just a (former) Perl hacker, :-)
-- 
/== Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ====\
| on contract to Intel's iWarp project, Hillsboro, Oregon, USA, Sol III  |
| merlyn at iwarp.intel.com ...!uunet!iwarp.intel.com!merlyn	         |
\== Cute Quote: "Welcome to Oregon... Home of the California Raisins!" ==/



More information about the Comp.unix.questions mailing list