OCCURENCES我有兩個文件:A和B.取消了所有從文件從一個文件B
A的內容:
http://example.com/1
http://example.com/2
http://example.com/3
http://example.com/4
http://example.com/5
http://example.com/6
http://example.com/7
http://example.com/8
http://example.com/9
http://example.com/4
內容從文件B:
http://example.com/1
http://example.com/3
http://example.com/9
http://example.com/4
現在,我想從文件中刪除A.在文件B線的所有OCCURENCES
我曾嘗試以下操作:
for LINK in $(sort -u B);do sed -i -e 's/"$LINK"//g' A; echo "Removed $LINK";done
但它沒有做任何事情。
如何關鍵是利用'sed'?你是否允許使用'sed'來編寫你的'sed'腳本?可以使用awk嗎?你提供的'grep'解決方案比使用'sed'或'awk'更簡單。 –
@JonathanLeffler不,它絕對不一定是sed。 – rhillhouse