LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-03-2008, 09:45 PM   #1
dina3e
Member
 
Registered: Mar 2008
Location: Bangalore
Distribution: Enterprise Red Hat linux
Posts: 98

Rep: Reputation: 16
Smile substitude the pattern in vi


i just want to substitude the multiple pattenm, i mean two to three word simulteneously. i.e
linux==LINUX
UNIX==unics
kernel==core
i need this replacement in vi editor .

as we do :s/linux/LINUX/g
this is for only one pattern .similarly i need all three in one.It's great if you put the knowdge in vi editor.
 
Old 04-03-2008, 11:21 PM   #2
Jerre Cope
Member
 
Registered: Oct 2003
Location: Texas (central)
Distribution: ubuntu,Slackware,knoppix
Posts: 323

Rep: Reputation: 37
Maybe you really want to use sed:

cat file1 | sed -e '1,$s/linux/LINUX/g' | \
sed -e '1,$s/kernel/core/g' >file2

vi is designed to give you quick visual feedback.

If you want to do programmatic large scale substitutions, try sed, awk, or perl.
 
Old 04-04-2008, 08:28 PM   #3
dina3e
Member
 
Registered: Mar 2008
Location: Bangalore
Distribution: Enterprise Red Hat linux
Posts: 98

Original Poster
Rep: Reputation: 16
Smile

yha , i need what u did here. but u had done in two substitution in the solution . but i need to do such many substitution in lot of time so it's not benificial for me .

e.g i want to convert some of character in the file from capital to small letter. so what method you had mention is not give the complete solution .
 
Old 04-04-2008, 11:10 PM   #4
djeikyb
Member
 
Registered: Nov 2005
Location: California
Distribution: ubuntu 10
Posts: 162

Rep: Reputation: 33
I'll second Jerre. You might look into writing a short sed script that you can modify as needed.

grymoire.com has some excellent tutorials, including one on sed.
 
Old 04-09-2008, 11:22 PM   #5
dina3e
Member
 
Registered: Mar 2008
Location: Bangalore
Distribution: Enterprise Red Hat linux
Posts: 98

Original Poster
Rep: Reputation: 16
it's really help full one

Quote:
Originally Posted by djeikyb View Post
I'll second Jerre. You might look into writing a short sed script that you can modify as needed.

grymoire.com has some excellent tutorials, including one on sed.
This document is really intersting one..also very much help full
thanks
 
  


Reply

Tags
editor, vi



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
printing pattern match and not whole line that matches pattern Avatar33 Programming 13 05-06-2009 06:17 AM
pattern matching nadeemr Linux - Newbie 8 06-13-2007 11:05 AM
Http pattern rigel_kent Programming 10 05-06-2006 01:24 PM
using grep when the pattern contains a ! farmerjoe Programming 9 03-15-2005 11:04 PM
Pattern Recognition trbdk3 Linux - Software 1 01-27-2005 01:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:07 AM.

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