`grep` stands for “global regular expression print”. It allows you to search plain text data sets for strings which match a regular expression or pattern.
Note that above we redirect the file matches to a new file. You don't have to do this. If you omit the redirection, `grep` will output to standard output.
The above example searches, using regex, for strings matching the pattern “banana” in the file `fruits.txt` regardless of the character case (`-i` ensures this) and outputs its findings to the file `banana.txt`, with the line number where the match occurs appended to the output (`-n` takes care of this).
Note that for simplicity, you can chain optional values together, i.e. the options in the above example could be input as `-in`.
`ripgrep` is generally faster however it does not come as default with Unix and only works recursively, i.e. it is designed to find strings within files within multiple directories not just single files or piped streams.
It also respects `.gitignore` files that it finds within directories by default and `node_modules` which is really handy.
Most of the standard `grep` options transfer over.