Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: Put your inplace-edit backup files into a subdir

by Aristotle (Chancellor)
on Apr 21, 2003 at 12:05 UTC ( #251978=note: print w/ replies, xml ) Need Help??


in reply to Re: Put your inplace-edit backup files into a subdir
in thread Put your inplace-edit backup files into a subdir

I was personally puzzled at what $^T is for a moment, though I knew about $^I. So the simple form would be

mkdir bak/ ; perl -pi'bak/*' -e 's/foo/bar/g' file1 file2 file3 ...
Or
perl -pi'bak/*' -e 'BEGIN { mkdir($^I =~ m!(.*/)!) } s/foo/bar/g' file +1 file2 file3 ...
Or maybe even
perl -MFile::Path -pi'bak/*' -e 'BEGIN { mkpath [ $^I =~ m!(.*/)! ] } +s/foo/bar/g' file1 file2 file3 ...
*grin*

Makeshifts last the longest.


Comment on Re^2: Put your inplace-edit backup files into a subdir
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://251978]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2014-09-17 06:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (60 votes), past polls