Using Perl Extensions
\w Match a "word" character (alphanumeric plus "_")
\W Match a non-word character
\s Match a whitespace character
\S Match a non-whitespace character
\d Match a digit character
\D Match a non-digit character
Notes:
perl -pe "s/(\w+)\s+(for|to)\s+(\w+)/<<$2 $3 $1>>/ig;" testfile.txt
Why does this not work as expected?
perl -pe "s/(\$\d+)/$100/g;" testfile.txt
Tell them about curly braces around vars to get:
perl -pe "s/(\$\d+)/${1}00/g;" testfile.txt
But then how to fix $000? How bout:
perl -pe "s/(\$\d{2,})/${1}00/g;" testfile.txt