2013-06-23 3 while read l; do f=${l%% *} c=${l#* }; (test $f = $c && echo || echo $c) >> $f; done < hoge bashの文字列置換は便利なんだけど、どうも末尾の空白文字を削ってるようにみえる hoge% cat -A hoge /etc/hosts 127.0.0.1^Ilocalhost$ /etc/hosts 127.0.1.1^Ihoge$ /etc/hosts $