shell命令批量处理文件

来源:互联网 发布:优化营商环境重要意义 编辑:程序博客网 时间:2024/05/23 16:17

1、请问如何从一个关键字文本集合里用grep批量筛选另一个文本?

grep -f seed.txt file.txtgrep -vf seed.txt file.txt

可扩展:

#!/bin/bashfor file in  ~/zjx/order_succ/*do    #filename=$(basename $file)    cat $file | while read line    do    echo ${line}|awk -F ',' '{print $2}' >> oo.txtdonedoneecho 'finish oo.txt!'cd ~/zjx/for file2 in ~/zjx/log/*do    #filename=$(basename $file2)    grep -vf oo.txt $file2 >> other_result.txtdoneecho 'finish other_result.txt!'
原创粉丝点击