私は2つのファイルがありますのAとB.削除し、すべての出現箇所
内容:ファイルBから
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
内容:今
http://example.com/1
http://example.com/3
http://example.com/9
http://example.com/4
を、ファイルBの行のすべてをファイルAから削除したいと考えています。
私は次のように試してみました:
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