Unix‎ > ‎

perl

Links
Perl Regular Expressions
Perl & LWP
Perl as a command line tool
Perl Tutorial: A basic program

Perl text replace
perl -i -pe 's/"SOURCE"/"REPLACE"/g'

Perl command line
perl <options> -e'<code>'

-p loop
-n loop & print $_ (foreach default var)
-l remove new line
-i Opens each file, reads from it, and replaces it with STDOUT.
cat servers.txt | perl -ne '!/(^[\d]*#.*)|(^\n)/ && print'

(^[\d]*#.*) - remover linhas comentadas
(^\n) - remover linhas brancas
Comments