|
|
|
|
google site
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|||
|
vi editor substitution
Hi everyone,
I am new to linux and practicing using vim editor. I am trying to substitute a word hi to hello and i can do this using by the following command s/hi/hello but this will only substitute only the first occurrence of hi and s/hi/hello/g will substitute every occurrence of hi. What if i want to only substitute the second occurrence of hi to hello? whats the command going to be? for example if a file contains hi hi hi hi then i want it to be hi hello hi hi hi Do I have to manually count the occurrence using /c option and say no to it? i guess there is a better way doing this . |
| Sponsored Links |
|
|
|
|||
|
Quote:
/<pattern> -- search for the pattern, press n, and now you are at the second occurence :. s/hi/hello/ or :. s/hi/hello/g There is no shortcut here. |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| substitution in VI editor | bhaskar_m | Shell Programming and Scripting | 2 | 03-16-2009 03:58 AM |
| Difference between "Command substitution" and "Process substitution" | royalibrahim | Shell Programming and Scripting | 3 | 12-15-2008 11:20 AM |
| Epic Editor was not able to obtain a license for your use. Feature Epic Editor :Licen | durgaprasadr13 | Solaris | 1 | 10-13-2008 08:39 AM |
| set EDITOR=vi -> default editor not setting for cron tab | aarora_98 | Shell Programming and Scripting | 6 | 09-13-2008 03:01 AM |
| Pasting text in VI editor from a different editor | harishmitty | UNIX for Dummies Questions & Answers | 10 | 09-10-2008 07:22 PM |