Software Development
Pages
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
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment