The grep command can accept input from two different methods: 1) From one or more files, like this: grep ' test ' file.txt (Added on ) By popular demand, many people suggested that I add this item as #0 to this list.
The root causes of these mistakes are: Not knowing what flavour of regular expression that grep is currently using (and/or not understanding what features that flavour supports) Not considering the escaping rules of your shell Issues with character encodings. I have chosen to document these mistakes in detail because they are mistakes that beginners are very likely to make at some point, but also to not be able to debug on their own. In this article, I'll discuss 5 very confusing mistakes that have caused me to waste significant amounts of time when using the command-line tool known as 'grep' to search for things. The Most Confusing Grep Mistakes I've Ever Made - By Robert Elder Introduction