in reply to Re^4: s// All Files In Directory
in thread s// All Files In Directory
No. You have to add the file names you want to work with after the command. In your case you want to work with all files, so append an asterisk (*). Also, add a file extension to 'i' if you want to create a backup:
perl -pi.bak -e 's/5/6/g;' *...will create a copy of each file with a .bak extension before performing the search/replace. If you only want to affect certain files, name them explicitly, or use glob patterns. For instance, the following will only work on files with a .txt extension:
perl -pi -e 's/5/6/g;' *.txt
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^6: s// All Files In Directory
by Anonymous Monk on Apr 02, 2012 at 20:58 UTC | |
Re^6: s// All Files In Directory
by perl.j (Pilgrim) on Apr 02, 2012 at 22:54 UTC | |
by vagabonding electron (Curate) on Apr 03, 2012 at 09:53 UTC | |
by aaron_baugher (Curate) on Apr 03, 2012 at 11:41 UTC | |
by vagabonding electron (Curate) on Apr 03, 2012 at 11:53 UTC |
In Section
Seekers of Perl Wisdom