Pages

2011-01-14

8 Awesome Perl Command Line Arguments You Should Know

"In this article, let us review how to use Perl command line options to do the following tasks:

* Edit file content
* Handle line separator
* Check syntax errors
* Load modules
* Perform looping
* Execute perl code
* Set input line separator
* Split the input line
* etc.,"

http://www.thegeekstuff.com/2010/06/perl-command-line-options/

For example, a one-line program to edit a file

$ perl -pi.bak  -e “tr/[a-z]/[A-Z]/” sample.txt

$ cat sample.txt
PRACTICAL EXTRACTION REPORT LANGUAGE

$ cat sample.txt.bak
Practical Extraction Report Language

No comments: