December 1999
Beginner
528 pages
11h 10m
English
Using the ^ allows you to match words or characters at the beginning of the line only. We could for example do a ls -l and match only directories, which we can do because if the first character of a ls -l is a ‘d’ then it’s a directory.
^d drwxrwxrw- – match -rw-rw-rw- – no match drwx-rwxr-x – match -rwx-r-x-r-x – no match
Returning to our code example, using ^001, this would match 001 at the beginning of the line:
1234XC9088 – no match 4523XX9001 – no match 0011XA9912 – match 9931XC3445 – no match
We can also combine various pattern matching, for example,
^...4XC....
would return:
1234XC9088 – match 4523XX9001 – no match 0011XA9912 – no match 9931XC3445 – no match
Read now
Unlock full access