Let's start by matching a single character. The most obvious way would be to use a literal character for alphabetic letters. If there is a metacharacter that you would like to match, you can escape it with the backslash (\).
$ ls /usr/bin | grep 'c\.d'
creatbyproc.d filebyproc.d newproc.d pidpersec.d runocc.d syscallbyproc.d syscallbysysc.d
Here's a simple regex example. We are looking for patterns that has a c, followed by a period (.), then a d.
From this we can notice two things:
The dot (.) metacharacter matches any single character.
$ ls /usr/bin/ | grep 'c.t'
bzcat codesign_allocate colcrt cut gencat gzcat locate policytool tccutil xmlcatalog ypcat zcat
Notice how a character must be present within between c and t. The dot metacharacter does not allow for the NUL character.
In the next section, we'll learn how to use bracket expansions, which will give you even more power in selecting single characters.
Relieve spasms, tight muscles, trigger points and pressure points with the Body Back Buddy! This trigger point massage is designed to help you self-message any area of your body - especially those that are hard to reach. Keeping your muscles relaxes and out of contraction is importan in helping to reduce pain and prevent muscle injury.$ Check price
In this completely revised second edition of the perennial best seller How Linux Works, author Brian Ward makes the concepts behind Linux internals accessible to anyone curious about the inner workings of the operating system. Inside, you'll find the kind of knowledge that normally comes from years of experience doing things the hard way.$ Check price