This chapter discusses:
• Match any string in the file name.
• Match a single character in the file name.
• Match the letters or numeric characters in the file name.
Here is these special characters:
* Match any string in the file name, including an empty string.
? Match any single character in the file name.
[...] Match any character included in [].
[! ...] matches [] Medium non-exclamation! The following characters.
When S H E L is encountered the above character, it will treat them as a special character, not the ordinary characters in the file name, so
Users can use them to match the corresponding file name.
For * and? More familiar, the use of DOS is almost
Use an asterisk * to match any string in the file name
• Use any individual characters that can match the file name
4.3 Use [...] and [! ...]
Use [.] Can be used to match any characters in square brackets []. In this method, a horizontal bar can also be used to connect two letters or numbers to represent a range. In the following example, the file name starting with I or O is listed:
LS [IO] *
Use [! 0 - 9] * to indicate the string of non-numbers, where! Is meaningful:
Ls log. [! 0-9] *
In order to list all file names starting with uppercase letters, you can use:
$ ls [a-z] *
In order to list all file names starting with lowercase letters, you can use:
$ ls [a-z] *
In order to list all file names starting with the number, you can use:
$ ls [0-9] *
Over