Wildcard characters
Use wildcard characters when you want to specify multiple files with similar names in one command. Without wildcard characters, you must repeat the command for each file.
In a command, you can use wildcard characters in the file name or file extension only. You cannot use them to specify destination files, file systems, or server names. You cannot specify a directory whose name contains an asterisk (*) or a question mark (?).
Valid wildcard characters that you can use include:
- *
- Asterisk. Matches zero or more characters.
- ?
- Question mark. Matches any single character at the present position.
The following table shows examples of each wildcard.
Pattern | Matches | Does not match |
---|---|---|
Asterisk (*) | ||
ab* | ab, abb, abxxx | a, b, aa, bb |
ab*rs | abrs, abtrs, abrsrs | ars, aabrs, abrss |
ab*ef*rs | abefrs, abefghrs | abefr, abers |
abcd.* | abcd.c, abcd.txt | abcd, abcdc, abcdtxt |
Question Mark (?) | ||
ab? | abc | ab, abab, abzzz |
ab?rs | abfrs | abrs, abllrs |
ab?ef?rs | abdefjrs | abefrs, abdefrs, abefjrs |
ab??rs | abcdrs, abzzrs | abrs, abjrs, abkkkrs |
Important: Use an asterisk (*) instead of a question mark
(?) as a wildcard character when trying to match a pattern on a multibyte
code page, to avoid unexpected results.
![AIX operating systems](./../common/images/ngaix.gif)
![HP-UX operating systems](./../common/images/nghpux.gif)
![Linux operating systems](./../common/images/nglinux.gif)
![Oracle Solaris operating systems](./../common/images/ngsolaris.gif)
![Mac OS X operating systems](./../common/images/ngmacosx.gif)
dsmc selective "/home/me/*.c"