开发者

text manipulation in shellscript

开发者 https://www.devze.com 2023-03-16 14:22 出处:网络
I want to ad开发者_高级运维d a dot to all lines that doesn\'t start with a dot.How can I do this in shellscript?should I use sed?

I want to ad开发者_高级运维d a dot to all lines that doesn't start with a dot. How can I do this in shellscript? should I use sed?

example file:
.a
a
b
.c

turns to

.a
.a
.b
.c


You can use sed:

sed -i '/^[^.]/s/^/./' text_file
0

精彩评论

暂无评论...
验证码 换一张
取 消