何百もの$
。
$ cat /tmp/file
$one $t $three
$one $t $three $t $three
sed
で始まる値のみを変更しようとします$t
。
$ sed "s/\$t/foo/g" /tmp/file
$one foo foohree
$one foo foohree foo foohree
ただし、上記のコマンドは$three
これらの値も置き換えます。これが起こらないようにするにはどうすればよいですか?
ベストアンサー1
努力する:
sed "s/\$t\>/foo/g" /tmp/file
\>
単語の終わりの正規表現パターンの一致。