sed error: unterminated 's' command

前端 未结 2 1238
伪装坚强ぢ
伪装坚强ぢ 2021-01-05 03:48

I run below sed command

sed -i s/abc=.*$/abc=def ghi/g hpq_sf_attach_wf_param.txt

and it gave me error:

sed: -e expression          


        
2条回答
  •  误落风尘
    2021-01-05 04:06

    So geekosaur had it right. The the reason you had the problem though is because it needs to be double quotes for the wildcards because with single quotes it takes them as literal characters, not for the meaning you want.

    sed -i "s/abc=.*$/abc=def ghi/g" hpq_sf_attach_wf_param.txt
    

    Also if the space between "def" and "ghi" gives you problems, adding a "\" should help making it read it as a literal space.

    sed -i "s/abc=.*$/abc=def\ ghi/g" hpq_sf_attach_wf_param.txt
    

提交回复
热议问题