## Wildcarding in UNIX

Wildcarding allows you to specify groups of files. You can use wildcards as an argument to ls, cp, mv, and rm, as well as to UNIX filters.

WildcardWhat it Represents
?any character
*any glob of zero or more characters
[crmf]any of c, m, r or f. You can put any list of caracters in the brackets to create a wildcard.
[a-z]any charcter falling asciicograpically from a to z. You can put any range of characters you wish in here and you can have more than one range.

Here are some useful examples and what they do.

• ls *.html  List all HTML files in your cwd
• ls */index.html List any file namead index.html in any immediate subdirectory of your cwd
• grep -l cos *.c List all .c files that contain the string "cos" in your current working directory.
• cat *f* |grep -i washington  Put all lines from files containing the letter f in your cwd that contain the word "washington" case-insensitive to stdout.
• ls [a-f][q-z]*.html This lists all files starting with a lower-case letter a-f then a lower case letter q-z followed by any other characters which have a .html extension.
• (desperation search)  grep -il */* regalis Print the names of all files one folder down that contain the text string regalis, case insensitive. Where'd I put those notes???