我想检查一行是否以标点符号(.,?!)结尾,如果没有,则添加句点.
A button is missing!
A button on their back allowed them to hug
A cat is carried by the scruff of its neck by a teenage boy?
A cattery is where cats are commercially housed
Run Code Online (Sandbox Code Playgroud)
输出:
A button is missing!
A button on their back allowed them to hug.
A cat is carried by the scruff of its neck by a teenage boy?
A cattery is where cats are commercially housed.
Run Code Online (Sandbox Code Playgroud)
我真的很难过,我试着点击一个字符串的最后一个字符 - 任何帮助?
使用sed:
sed -i.bak 's/[^[:punct:]]$/&./' file
A button is missing!
A button on their back allowed them to hug.
A cat is carried by the scruff of its neck by a teenage boy?
A cattery is where cats are commercially housed.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
769 次 |
| 最近记录: |