geostorm.org


UTC 08:55:57
Sunday
8/1/2010



August 2010
SuMoTuWeThFrSa
1234567
891011121314
15161718192021
22232425262728
293031    
       

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.