![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Local shell script need to be executed on a remote linux box | rajeshomallur | Linux | 6 | 05-02-2008 10:05 AM |
| perl - why is the shell script executed before the print command? | mjays | Shell Programming and Scripting | 3 | 09-21-2007 02:49 AM |
| Unix shell script couldn't be executed. Pls help! | duke0001 | Shell Programming and Scripting | 8 | 09-14-2006 08:15 PM |
| Shell script doesn't get executed using crontab | radhika | Shell Programming and Scripting | 11 | 06-09-2005 01:28 PM |
| simple shell - how to get a parameter typed in a shell script | cmitulescu | Shell Programming and Scripting | 3 | 12-05-2001 12:04 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Help - Need simple example of VI executed in shell script
Please help - I have seen others ask this question but I need a simple example of using vi in a shell script. Once I enter VI the shell script does not execute the next commands until I q!. I invoke VI and start the edit process. I want to go to the third line and replace a character with a new character and then :wq. There must be a special character set required to feed the script. Not sure how to get <esc> intol script, if I need it at all. A simple example would be great. Please type and reply. Thanks
|
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Traditionally, vi is an interactive editor. I am hardpressed to imagine a situation where its functionality can not be replaced by sed -- the stream editor -- or a pipeline series of grep, awk, etc... I'd advise avoiding the vi solution though I'm sure it is possible.
Can you be more specific with your data? For example, are you always replacing a character on the third line only or is there a specific pattern that uniquely identifies that line? Here is a simple example that replaces all lowercase 'e' characters with an uppercase 'E' on line 3 only. Given the following file: Code:
$ cat file line 1 one line 2 two line 3 three line 4 four $ cat file | sed -e "3s/e/E/g" line 1 one line 2 two linE 3 thrEE line 4 four Code:
$ cat file | sed -e "3s/e/E/g" 1>file.tmp && mv file.tmp file Last edited by hegemaro; 06-03-2006 at 09:49 AM. |
|
#3
|
|||
|
|||
|
Thanks for the SED command - will work well
Thanks for the SED. This should work well and achieve my goal.
|
|||
| Google The UNIX and Linux Forums |