Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
例如,我有一个包含许多文件的目录(比如 f1.dat、f2.dat ...、f100.dat)。我想找出哪个文件包含一个字符串(比如字符串“error”)。怎么做。
你可以做:
grep -l "your_string" /your/dir/f*.dat
-l
f*.dat
f[something].dat
如果您想从目录中的所有文件中检查它,那么这可能很有用:
grep -l "your_string" /your/dir/