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 tasks, as we'll discuss in this section.
grep '^Nantucket' limerick*
Here, we use grep to find all of the lines in the limericks that start with Nantucket, if there are any.
grep 'Nantucket$' limerick*
Similarly, you can find the lines that end with Nantucket.
grep '^[A-Z]' limerick
Or, you can find the lines that start with a capital letter by including the [A-Z] regular expression.
grep '^[A-Z a-z]' limerick
Here, you can find all the lines that start with any letter, but not a number or symbol. Fancy, huh?
You can also use regular expressions with awk and sed. See Making Global Changes with sed and Changing Files with awk in this chapter for details.