ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I'm having some trouble figuring out how to do replace a single character in some output I'm working with. I'm pretty sure sed will take care of it for me, but I haven't quite figured it out.
sed -i.bck 's/\(.*\)[.]\([0-9]*,.*\)$/\1:\2/g' file
the regular expression matches any string .* plus a literal dot [.] plus any number [0-9]* followed by a comma plus any string to the end of the line ,.*$
Thank you for the quick reply. Everything works great. I did notice that I have to run the string multiple times to get both the :'s in there. Which is completely not a big deal, I was just curious if there was a way to make them do both at the same time?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.