Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: s// All Files In Directory

by Happy-the-monk (Abbot)
on Apr 02, 2012 at 19:37 UTC ( #963098=note: print w/ replies, xml ) Need Help??

in reply to s// All Files In Directory

How can I open all of the file in the directory, and substitute all of the 5s for 6s?

perldoc perlrun yields the answer to your question. Have a look for -pi.

Cheers, Sören

Comment on Re: s// All Files In Directory
Replies are listed 'Best First'.
Re^2: s// All Files In Directory
by perl.j (Pilgrim) on Apr 02, 2012 at 19:47 UTC
    I'm not too good with the command line (I'm a Windows guy :-). So in what syntax would I use -pi?

      Learn to be good with the command line. Being saddled with Windows is no excuse; if you can't stand the Windows command line (I can't), install Cygwin.

      -p process line-by-line and print the results -i operate on files in place -e execute the following code Hence: perl -p -i -e 's/foo/bar/g' *

      Aaron B.
      My Woefully Neglected Blog, where I occasionally mention Perl.

        So perl -p -i -e 's/5/6/g' will do what I want?

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (14)
As of 2015-11-25 15:46 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (681 votes), past polls