Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 09-24-2009, 02:01 PM   #1
LQ Newbie
Registered: Sep 2009
Posts: 2

Rep: Reputation: 0
Help with a sed substitution string

I have a huge file and trying to sed to clean it up.

I have lines like the following
I need this line to look like this
The 59 in this case will be variable, but it will always be 2 digits. I need to remove the cent sign, and put 0. preceeding the 2 digit value there.
Please help with my substitution command, thanks
The 59 may not always be in the same place in the line, so referring to the end of line $ will probably not work.

Last edited by hawgwild; 09-24-2009 at 02:09 PM. Reason: addendum
Old 09-24-2009, 02:11 PM   #2
LQ Newbie
Registered: Nov 2008
Posts: 6

Rep: Reputation: 1
It should work

sed 's/,\([0-9][0-9]\)/,0.\1/g'

from within vim

Old 09-24-2009, 02:35 PM   #3
LQ Newbie
Registered: Sep 2009
Posts: 2

Original Poster
Rep: Reputation: 0
thanks, that puts me on the right track


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with a substitution using sed wtaicken Programming 4 12-15-2008 04:04 AM
String Substitution Swapna173 Linux - Newbie 1 08-04-2008 06:22 AM
variable substitution in sed gaynut Programming 1 07-14-2008 07:38 AM
Substitution of a long string horacioemilio Programming 5 04-07-2008 09:21 PM
Complicated string substitution horacioemilio Programming 5 02-13-2008 06:40 PM

All times are GMT -5. The time now is 04:57 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration