Using other examples of regular expressions
In the previous section, we showed you how to use the grep command to search with regular expressions. You can, though, do other neat finding things tasks, as we'll discuss in this section.
To review files and spell check them:
- In this example, we use the regular expression [1256] to find limerick1.htm, limerick2.htm, and so on. Then, we pipe the four files to spell for a quick spell check.
cat limerick[1256].htm | spell
To find lines with specific characteristics:
1. | grep ^Nantucket limerick* |
2. | grep Nantucket$ limerick* |
3. | grep ^[A-Z] ... |
Get Unix: Visual QuickStart Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.