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.
我必须在 jad 文件中就地编辑一行。
MIDlet-Version: 0.5.38应该成为MIDlet-Version: 0538
MIDlet-Version: 0.5.38
MIDlet-Version: 0538
我无法在文件中找到该行。如果我已经有了这条线,我会这样做:
echo 'MIDlet-Version: 0.5.38' | sed s/\\.//g
我尝试了几种变体:
sed -i 's/\(MIDlet-Version: \)\\.//replace/g' myfile.jad
有人可以告诉我出了什么问题以及如何正确处理吗?
你要:
sed -i '/MIDlet-Version: /{s/\.//g}' file.jad
file.jad 这将仅从包含更改的行中删除所有句点MIDlet-Version:并将更改存储回file.jad.
file.jad
MIDlet-Version: