Slide 7 of 12
Notes:
^ before you start, put on your hat.
perl -ne "print if m/^start/i;" testfile.txt
. Perl has to "stop" at every character.
perl -ne "print if m/./i;" testfile.txt
$ In the end, we all make money.
perl -ne "print if m/can$/i;" testfile.txt
| Think of an oar (or) sticking in the air.
perl -ne "print if m/this|that|those/i;" testfile.txt
mod:perl -ne "print if m/^this|that|those/i;" testfile.txt
mod:perl -ne "print if s/windows/unix/ig;" testfile.txt
() perl -pe "s/like (\w+)/NOT like $1/i;" testfile.txt
[] Means any of the characters within the brackets match.
Special operators ^ and -.
perl -ne "print if m/th[oe]s/i;" testfile.txt
rev: perl -ne "print if m/th[^i]s/i;" testfile.txt
perl -ne "print if m/[a-zA-Z]:/;" testfile.txt
perl -ne "print if m/\$[0-9]/;" testfile.txt
\ perl -ne "print if m/\[/;" testfile.txt
perl -ne "print if m/\(|\[|\.|\$/;" testfile.txt