我有2檔案 File1, and File2。File1是strings, line1 contain string1, 的串列line2 contains strings2 and so on。我想挑選string1的File1,并與比較File 2。然后我選擇string2并與File2. 腳本不知道 中有多少個字串File1 and Fil2。一旦File1 are compared with File2,腳本中的所有字串都應該給出匹配alarm/pop up window的串列。stringsFile2
uj5u.com熱心網友回復:
我不明白你說的彈出視窗是什么意思。此外,最好使用 grep 之類的東西。根據要求,這就是我想出的。
// abc.txt
abcd
ab
cd
abc
// def.txt
dfd
abc
ab
abcd
file1=()
file2=()
filename1="abc.txt"
filename2="def.txt"
while read -r line; do
name="$line"
file1 =("$name")
done < "$filename1"
while read -r line; do
name="$line"
file2 =("$name")
done < "$filename2"
for i in "${file2[@]}"
do
for j in "${file1[@]}"
do
if [ "$i" = "$j" ]; then
echo "Match found $i"
break
fi
done
done
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/374245.html
