
This kind of wildcard specifies an “or” relationship (you only need one to match). For example, these would work: mam, mbm, mcm, mdm. If you did mm it can become: mam, mum, mom if you did: mm it can become anything that starts and ends with m and has any character a to d inbetween. So "a$" means find a line ending with an "a".įor example, this command searches the file myfile for lines starting with an "s" and ending with an "n", and prints them to the standard output (screen): cat myfile | grep '^s.*n$' (square brackets) So "^a" means find a line starting with an "a". n* will match n, nn, nnnn, nnnnnnn but not na or any other character. The proceeding item is to be matched zero or more times. Is used to match any string, equivalent to * in standard wildcards. Note you may need to use quotation marks and backslash(es).* (dot and asterisk) to protect a subsequent special character. Thus, "m.a" matches "mpa" and "mea" but not "ma" or "mppa". Will match any single character, equivalent to ? (question mark) in standard wildcard expressions. Note you may need to use quotation marks and backslash(es). myfiles1, myfiles2 etc) but won't remove a file with the number 9 anywhere within it's name. For example rm myfile will remove all myfiles* (ie. This construct is similar to the construct, except rather than matching any characters inside the brackets, it'll match any character, as long as it is not listed between the. Note that spaces are not allowed after the commas (or anywhere else).


"m*l" could by mill, mull, ml, and anything that starts with an m and ends with an l. If you specified a "cd*" it would use "cda", "cdrom", "cdrecord" and anything that starts with “cd” also including “cd” itself. This can represent any number of characters (including zero, in other words, zero or more characters). If you specified something at the command line like "hd?" GNU/Linux would look for hda, hdb, hdc and every other letter/number between a-z, 0-9.
