Sal*_*tch 6 linux bash shell search file
我需要创建一个bash脚本,它遍历目录中的一堆.txt文件,然后在每个.txt中搜索一个字符串,并返回字符串出现的整行.
我知道如何查看目录中的所有.txt文件,
我只需要指向正确的方向来搜索文件本身,并根据该行中的匹配返回一行
ami*_*t_g 10
在一个目录内
grep "search string" *.txt
搜索或转到子目录
find /full/path/to/dir -name "*.txt" -exec grep "search string" {} ;\
归档时间:
14 年,10 月 前
查看次数:
15045 次
最近记录:
8 年,8 月 前