You are likely to be familiar with using a search dialog (usually invoked with the
Ctrl+F shortcut) to locate the occurrences of a particular string. The
grep command is a versatile and feature-rich version of that search functionality usable from the command line. An important feature that GUI applications may lack is regular expressions, a mini-programming language to precisely define a matching criteria.
This book heavily leans on examples to present features one by one. In addition to command options, regular expressions will also be discussed in detail. Two different implementations are discussed in this book — GNU grep and ripgrep.
Exercises are also included to test your understanding.
You should be familiar with command line usage in a Unix-like environment. You should also be comfortable with concepts like file redirection and command pipelines.
You are also expected to get comfortable with reading manuals, searching online, visiting external links provided for further reading, tinkering with illustrated examples, asking for help when you are stuck and so on. In other words, be proactive and curious instead of just consuming the content passively.
For a preview of the book, see sample chapters on GitHub.
Visit https://github.com/learnbyexample/learn_gnugrep_ripgrep for markdown source, example files, exercise solutions and other details related to the book.
Based on the book contents as well as the exercises, I made an interactive TUI app with 50+ questions. Reference solutions are provided for both
GNU grep and
- Frequently used options
- BRE/ERE Regular Expressions
- Context matching
- Recursive search
- Miscellaneous options
- Perl Compatible Regular Expressions
- Gotchas and Tricks
- Further Reading
Feedback and Errata
I would highly appreciate it if you'd let me know how you felt about this ebook. It could be anything from a simple thank you, Gumroad rating, pointing out a typo, mistakes in code snippets, which aspects of the book worked for you (or didn't!) and so on. Reader feedback is essential and especially so for self-published authors.
You can reach me via:
- Issue Manager: https://github.com/learnbyexample/learn_gnugrep_ripgrep/issues
- E-mail: firstname.lastname@example.org
- Twitter: https://twitter.com/learn_byexample
You'll get PDF and EPUB versions of the book.