[英]How to grep file by another file's line using bash
要grep的file1商店Sentence,這里的內容file1
.|||anymore .
,|||arguments
,|||atheists
,|||be
,|||because the
.|||because the
問題是它在某些句子中包含空格 ,而目標file2也包含空格,我如何搜索所有file2內容以了解file2是否在file1中包含這些句子
如果找到,則將grep結果輸出到另一個文件(追加),如果找不到,則輸出文件進行保存
嘗試這個-
while IFS= read -r i; do #Reading the file line by line and saving lines in $i.
grep "$i" file2 >> output #Grepping the line in the second file and outputting.
done < file1
您的問題需要進行編輯以提供更多詳細信息。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.