- 論壇徽章:
- 145
|
本帖最后由 jason680 于 2014-11-16 15:05 編輯
回復(fù) 6# dt1826
>> ...問題是find如何處理*?看作普通字符?通配符?還是正則元字符?
$ ls
11 123 1.bak 1.txt
1. 通配符
$ find . -name "1.*"
./1.txt
./1.bak
2. 正則
$ find . -regex "./1.*"
./11
./1.txt
./1.bak
./123
Note: more detail information by 'man find' command
$ man find
NAME
find - search for files in a directory hierarchy
...
-name pattern
Base of file name (the path with the leading directories
removed) matches shell pattern pattern. The metacharacters
(`*', `?', and `[]') match a `.' at the start of the base name ...
-regex pattern
File name matches regular expression pattern. This is a match
on the whole path, not a search. For example, to match a file
named `./fubar3', you can use the regular expression `.*bar.' or
`.*b.*3', but not `f.*r3'. The regular expressions understood
by find are by default Emacs Regular Expressions, but this can
be changed with the -regextype option. ...
|
|