Linux: grep, part 0

Self-tutoring about [Li|U]nix: the tutor begins about grep.

grep string filename looks for the string in the file called filename. The string can be a regular expression. In my experience, a regex needs to be quoted. For instance, on the system I use,

grep “^[p|d][0-9]” input

will find p91 and also d899.txt as well. grep will return the entire line the match is found in.

Not all systems treat grep with regex exactly the same — some claim they won’t support the or operator without using grep -E.

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

Leave a Reply