Grep
VIDEO
What is Grep?
grep is a pattern matching tool
grep can be used as a search tool
grep can use Regular Expressions (regex) to help find more complex patterns
grep can be used with pipe or by itself to search the contents of files
There are different forms of grep, so it's important to make sure you know which one you're using and why
What is Grep good at?
Pattern matching
Pattern matching using plain text or regex
Finding things that either match a pattern, or everything that doesn't match a pattern
What is Grep not so good at?
Reading minds, grep is very literal and will find exactly what you tell it to even if "that's not really what you meant"
Anything that isn't pattern matching, so grep is not good at replacements, substitutions, sorting or anything like that
Some examples of how to use grep as shown in the video
cat file | grep pattern
grep file pattern
grep file option pattern
grep pattern file | grep secondPattern
Some Grep Resources
Suggested Resources and Exercises:
Download the GrepLab File by right clicking Here and saving your file onto your Linux machine, and then Complete the problem sets that are found on This PDF using the GrepLab file you downloaded from above. Make sure you are paying attention to file location and your paths
Would you like to see some more classes?
Click here