I am writing a command line perl program to replace text content in a file .I know that the following instruction executes successfully on one of the unix machine. I am trying to execute it through cygwin.
perl -pi -e 's/siva/prabu/g;' TestScript.xml
But I get following error.
Can't do inplace edit without backup.
I tried to run:
perl -pi 'Temp.bak' -e 's/siva/prabu/g;' TestScript.xml
It gives me
Can't open -e: No such file or directory.
Can't open s/siva/prabu/g;: No such file or directory.
Can't do inplace edit without backup.
Solution :
perl -pi.bak -e 's/siva/prabu/g;' TestScript.xml
or
perl -pi.bak -e "/siva/prabu/g;" TestScript.xml
Tuesday, March 24, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment