Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 04-03-2006, 05:35 AM   #1
LQ Newbie
Registered: Apr 2006
Posts: 3

Rep: Reputation: 0
how to replace numbers in vi ?

i have to change all numbers in the text in vi like this --> xxx,xxx

how to do it in one-line command ?
Old 04-03-2006, 05:44 AM   #2
Pavan mahoorker
LQ Newbie
Registered: Sep 2004
Location: Bangalore
Posts: 7

Rep: Reputation: 0
First come out of your insert or append mode in vi by presseing the Esc button then type as below.
:%s/,xxx the enter key
And if you want to replace every where then use :%s/,xxx/g
Old 04-03-2006, 03:42 PM   #3
LQ Newbie
Registered: Apr 2006
Posts: 3

Original Poster
Rep: Reputation: 0
advanced regular expression in vi

thanks, but it's not satisfactionary (?!) answer, because I have to replace only these dots which are neighbours of the numbers.

for example : '12.45' should be replaced to '12,45' , '26.3' to '26,3' etc. ; but the result of '' should not be 'linux,com' ! (no changes in this example !)

I have to use an advanced regular expression, but I don't know how
Old 04-03-2006, 03:49 PM   #4
LQ Newbie
Registered: Apr 2003
Location: Huntsville, AL
Distribution: mandrake
Posts: 4

Rep: Reputation: 0
use something like:

Old 04-03-2006, 04:31 PM   #5
LQ Newbie
Registered: Apr 2006
Posts: 3

Original Poster
Rep: Reputation: 0
it's really works !

thanks for you , 2 points for me


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
Even numbers paraiso Linux - Newbie 4 05-15-2005 03:31 PM
what do the numbers mean? drisay Slackware 1 12-14-2004 07:30 AM
54 digit numbers Scratchit General 3 06-23-2004 09:24 AM
Adding numbers, break on non-numbers... Cruger Programming 1 03-22-2004 09:18 AM
problem in perl replace command with slash (/) in search/replace string ramesh_ps1 Red Hat 4 09-10-2003 01:04 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:32 PM.

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
Open Source Consulting | Domain Registration