shell脚本-两个list查找匹配项
#!/bin/bash
search_list='xx/search_list.txt'
list='xx/revise_list.txt'
result='xx/result.txt'
# 逐行读取list文件
while IFS= read -r line; do
# 在search_list文件中查找匹配项
match=$(grep -F "$line" "$search_list")
# 如果有匹配项,则写入到result文件,否则写入not match
if [ -n "$match" ]; then
echo "match ${line}" >> "$result"
else
echo "not match ${line}" >> "$result"
fi
done < "$list"
浙公网安备 33010602011771号