我有一個屬性文件。我需要更新一些字段。使用sed更新文件使字符出現在行尾
dirParam.dprop_release_version=4.1.1
dirParam.dprop_writeToFile=true
於是我跑到下面的命令
$ sed -i -e "/dirParam\.dprop_release_version=/ s/=.*/=4\.10\.10/" -e "/dirParam\.dprop_writeToFile=/ s/=.*/=false/" file.properties
更新後,下面是我發現了什麼。它正在更新...
^M
^M
dirParam.dprop_release_version=4.10.10
dirParam.dprop_writeToFile=false^M
^M
但是,我可以看到"^M"
字符在行尾。這是什麼,我是哪裏我錯了。
注意:Red hat linux
我建議使用'dos2unix文件名'來擺脫'^ M'。 – Cyrus