Perl Scripts
(March 2006)
Perl is a powerful interpreted programming language.
This page presents some perl scripts.
shell> perl -pe 's/<([^>]*)>/[\1]/g'
one <two> three <4> 5
one [two] three [4] 5
shell> perl -pe 'undef $/;s/NEWTYPE.*?ENDNEWTYPE\s*;//sg' < file.txt
Explanations:
- $/ is the input field separator. Its default value is usually "\n" (new line).
- The ? in .*? make the .* less greedy (as small as possible).
- With the final /s, the dot (.) may represent "\n" (normally it does not).