valavanp has asked for the wisdom of the Perl Monks concerning the following question:
I want to replace 3 instances of file path in a directory by using perl oneliner. This is the command which i gave and worked well.
perl -e 's/\/usr\/bin\/perl/\/test\/test\/test/g;s/\/ggg\/ggg\/www/\/z +zz\/zzz\/zzz/g;s/\/jjj\/jjj\/jjj/\/aaa\/aaa\/aaa/g;' -pi *.pl
But when i include this oneliner in a separate file called script.pl i am getting compilations errors here is how i have given;
#!/usr/local/bin/perl use strict; use warnings; perl -e 's/\/usr\/bin\/perl/\/test\/test\/test/g;s/\/ggg\/ggg\/www/\/z +zz\/zzz\/zzz/g;s/\/jjj\/jjj\/jjj/\/aaa\/aaa\/aaa/g;' -pi *.pl print "Done";
The following error occurred for me when i compile this.
syntax error at script.pl line 8, near "perl -e " script.pl had compilation errors
Can anyone tell me where i am wrong? Thanks monks for your valuable suggestion.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perl oneliners
by shmem (Chancellor) on Aug 19, 2006 at 08:45 UTC | |
by valavanp (Curate) on Aug 19, 2006 at 10:47 UTC | |
by davidrw (Prior) on Aug 19, 2006 at 12:39 UTC | |
by graff (Chancellor) on Aug 19, 2006 at 16:59 UTC |