Vil*_*age 3 regex bash replace sed
我有一个这样的文件:
Once upon a time there lived a cat.
The cat lived in the forest.
The forest had many trees.
Run Code Online (Sandbox Code Playgroud)
我需要用“@”替换每行的最后一个空格,例如:
Once upon a time there lived a@cat.
The cat lived in the@forest.
The forest had many@trees.
Run Code Online (Sandbox Code Playgroud)
我尝试过sed 's/ .*$/@/g' file.txt,但.*匹配所有内容并删除在那里找到的所有文本。
如何用“@”替换每行最后一个空格?