Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
sedコマンドで変数を使用するには?
元:sed '/Jagan/s/Hi/HELLO/' file
sed '/Jagan/s/Hi/HELLO/' file
Hiここで変数に置き換えたい
Hi
var1=Hi sed '/Jagan/s/$var1/HELLO/' file
"の代わりに使用':
"
'
sed "/Jagan/s/$var1/HELLO/"
編集:二重引用符"により、シェルは文字列内の変数を展開できます。一重引用符'はこれを許可しません。