- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Changing many words into a file using vi
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2006 05:46 AM
09-20-2006 05:46 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2006 05:53 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2006 05:54 AM
09-20-2006 05:54 AM
Re: Changing many words into a file using vi
I believe you want:
1. Position your cursor where ever it is that you want to add the contents of another file;
2. Type a colon character (":") followed by an "r" (for "read"); a space, and the name of the file that you want inserted.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2006 05:55 AM
09-20-2006 05:55 AM
Re: Changing many words into a file using vi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2006 06:03 AM
09-20-2006 06:03 AM
Re: Changing many words into a file using vi
This are the options in vi to replace text:
Replacing Text: This amounts to combining two steps; deleting, then inserting text.
r replace 1 character (under the cursor) with another character
8r replace each of the next 8 characters with a given character
R overwrite; replace text with typed input, ended with Esc
C replace from cursor to end of line, with typed input (ended with Esc)
S replace entire line with typed input (ended with Esc)
4S replace 4 lines with typed input (ended with Esc)
cw replace (remainder of) word with typed input (ended with Esc)
And this is the link to the source of information, you may want to add it your favorites:
http://amath.colorado.edu/computing/unix/vi/
Regards,
Jaime.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2006 06:08 AM
09-20-2006 06:08 AM
Re: Changing many words into a file using vi
'cat' may be a better choice:
# cat f1 f2 f3 f4 > f5
PCS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2006 06:33 AM
09-20-2006 06:33 AM
Re: Changing many words into a file using vi
How about...
:nr file **read file and insert after line number.
or
:r file ** Read file and insert after the current line.
sp,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2006 06:39 AM
09-20-2006 06:39 AM
Re: Changing many words into a file using vi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2006 12:51 AM
09-21-2006 12:51 AM
Re: Changing many words into a file using vi
i want to know something about the following commando:
:%s/Joe/Bob/g
do i have to use it how above is shown?
Thanks, Manuales.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2006 01:01 AM
09-21-2006 01:01 AM
Re: Changing many words into a file using vi
From the "Vi Quick Reference":
http://www.yingjenie.com/ying/linux/vi/
Replace next occurrence of old with new
:s/old/new
Replace all occurrences on the line
:s/old/new/g
Replace all occurrences from line x to y
:x,ys/old/new/g
Replace all occurrences in file
:%s/old/new/g
Replace all occurrences in file w/confirmation
:%s/old/new/gc
PCS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2006 01:51 AM
09-21-2006 01:51 AM
Re: Changing many words into a file using vi
So I use ,
:%s;
This way I can replace /dev/vg00 with /dev/vg01. If I go with "/" as delimiter I would have to type
:%s/\/dev\/vg00/\/dev\/vg01/g
Regds,
Kaps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2006 01:53 AM
09-21-2006 01:53 AM
Re: Changing many words into a file using vi
i want to know something about the following commando:
:%s/Joe/Bob/g
do i have to use it how above is shown?
Thanks, Manuales.
========================
If you use above syntax in vi then it will replace "Joe" to "Bob" in the whole file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2006 04:33 AM
09-21-2006 04:33 AM
Re: Changing many words into a file using vi
to chnage all 'A' to 'B':
:%s/A/B/G
HTH,
Art