fusionplant.com


UTC 06:28:48
Wednesday
2/8/2012



February 2012
SuMoTuWeThFrSa
   1234
567891011
12131415161718
19202122232425
26272829   
       

welcome

One Line of Program at Command Prompt



To execute one line of code on a file and print the results to standard output:
perl -pe ' your single line of code here ' filename.txt
-e tells perl to execute code between quotes.
-p prints the results to your screen

Example:
perl -pe 's/search/replace/g' filename.txt



To execute one line of code on a file, write results to that file and keep a backup copy of the original:
perl -p -i~ -e '...your code...' file.txt
The -i tells perl to keep a backup of the original. The ~ is what's appended to the backup file name.