檔案1.txt
Mango
Oranges
檔案2.txt
Mango
Apple
我想找到一個檔案與另一個檔案的差異。我期待輸出為
oranges
我想比較 file1 與 file2 的不同。檔案 1 中存在但檔案 2 中不存在的內容。我已經使用diff file1.txt file2.txt它在兩個檔案之間給了我所有不同的值
uj5u.com熱心網友回復:
您可以使用comm
comm -23 \
<(cat File1.txt | tr '[:upper:]' '[:lower:]' | sort -u) \
<(cat File2.txt | tr '[:upper:]' '[:lower:]' | sort -u)
oranges
或者awk
awk '
{
w = tolower($0)
}
FNR == NR {
words[w]
next
}
w in words {
delete words[w]
}
END {
for (w in words)
print w
}
' File1.txt File2.txt
oranges
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/479313.html
上一篇:在導航欄中使用帶有文本的影像
