Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
12-12-2005, 02:41 AM
|
#1
|
Senior Member
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983
|
some vim help pelase.
i was attempting to update my yum.conf for CentOS 4 from the 4.1 to 4.2 using vim.
IIRC and if i understand vi correctly i could type the following to find and replace all 4.1 with 4.2.
:s/4.1/4.2:g
and that should swap all of the 4.1 with 4.2 globally in the file. i was getting an error pattern 4.1 not found, yet it clearly highlighted all of the 4.1 in the file. so what was i doing wrong?
|
|
|
12-12-2005, 04:17 AM
|
#2
|
LQ Guru
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507
Rep: 
|
I'm probably wrong, but I think you need:
|
|
|
12-12-2005, 04:47 AM
|
#3
|
LQ Guru
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298
Rep:
|
What you should have done is installed the centos-release rpm for 4.2 and that would have done it for you. To upgrade you would then just run "yum upgrade".
|
|
|
12-12-2005, 09:09 AM
|
#4
|
Senior Member
Registered: Oct 2003
Posts: 3,057
Rep:
|
The vi substitution for the whole doc should be something like this:
:%s/4.1/4.2
|
|
|
12-12-2005, 10:07 AM
|
#5
|
Senior Member
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,516
|
You need to escape the dots.
. = any character, so will change 401 into 4.2
safer is:
:g/4\.1/s//4\.2/gc will ask for confirmation
or in perl:
perl -pi.bak 's/4\.1/4\.2/g' <filename>
will do it and make <filename>.bak
but reddazz is probly more correct. 
|
|
|
12-12-2005, 11:20 AM
|
#6
|
Member
Registered: Sep 2005
Location: Coimbatore
Distribution: Prabuayyappan
Posts: 32
Rep:
|
:%s/4\.1/4\.2/g
This will replace the 4.1 with 4.2 globally.To ask for confirmation add c
To get more info on vi
http://www.math.mcgill.ca/lebaron/ru...00000000000000
|
|
|
12-12-2005, 01:19 PM
|
#7
|
Member
Registered: Sep 2005
Location: New delhi
Distribution: RHEL 3.0/4.0
Posts: 777
Rep:
|
Quote:
Originally Posted by prabuayyappan
|
Thanks prabuayyappan for the link.
|
|
|
12-12-2005, 04:33 PM
|
#8
|
Senior Member
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983
Original Poster
|
thanks all of you for the great info and help.
|
|
|
All times are GMT -5. The time now is 02:31 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|