cup*_*kob 25 regex linux console command find
当我使用命令时:
find . | xargs grep '...'
Run Code Online (Sandbox Code Playgroud)
我得到了错误的比赛.我正在尝试...
在当前文件夹中的所有文件中搜索字符串.
Ste*_*epp 38
正如安迪怀特所说,你必须使用fgrep
才能匹配平原.
,或逃脱点.
所以你必须写(-type f
只有文件:你显然不想要这些目录.):
find . -type f | xargs fgrep '...'
Run Code Online (Sandbox Code Playgroud)
或者如果你还想使用grep:
find . -type f | xargs grep '\.\.\.'
Run Code Online (Sandbox Code Playgroud)
如果您只想要当前目录而不是其子目录:
find . -maxdepth 1 -type f | xargs fgrep '...'
Run Code Online (Sandbox Code Playgroud)
'' 匹配任何字符,因此您将找到包含3个或更多字符的所有行.
你可以逃脱点,像这样:
find . | xargs grep '\.\.\.'
Run Code Online (Sandbox Code Playgroud)
或者您可以使用fgrep,它执行文字匹配而不是正则表达式匹配:
find . | xargs fgrep '...'
Run Code Online (Sandbox Code Playgroud)
(某些版本的grep也接受-F标志,这使得它们的行为类似于fgrep.)