Software Development
Pages
(Move to ...)
Home
About
Contact
▼
Thursday, July 16, 2009
How to replace space with comma in sed
test.txt :
Bugs Bunny
Daffy Duck
cat test.txt | sed -e 's/[ ]/,/g'
outputs:
Bugs, Bunny
Daffy, Duck
cat test.txt | sed -e 's/[ ]/,/g' | sed 's/$/,/'
will append comma to the end as well, so:
Bugs, Bunny,
Daffy, Duck,
No comments:
Post a Comment
‹
›
Home
View web version
No comments:
Post a Comment