Need to overwrite shell script using vi editor


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need to overwrite shell script using vi editor
# 1  
Old 04-11-2013
Need to overwrite shell script using vi editor

I have an existing shell script that I am trying to modify. I have about 10 lines of info I want to overwrite using text someone emailed to me. I guess what I am trying to do basically is like a copy/paste, but it's not working for me.

I am using Cygwin and vi editor.

I open the script and go into insert mode. I am deleting the lines I don't need by putting the cursor in the line I want gone and typing esc + dd.

I want to paste about 10 lines in of the script that was emailed to me. I use a esc + p to paste, but that command pastes in the lines that I just deleted instead of what I copied from the email.

Is there a way to paste the text from the email into my script?
# 2  
Old 04-11-2013
just go to insert mode in vi (esc i) and paste the text from the email via right mouse button to the terminal/cygwin window.
# 3  
Old 04-11-2013
Quote:
Originally Posted by DukeNuke2
just go to insert mode in vi (esc i) and paste the text from the email via right mouse button to the terminal/cygwin window.
That is exactly what I tried. When I paste the text from the email, it actually puts the lines of text I just deleted back instead of my email.

esc + p command per the vi command list I found from googling says esc + p "to paste the text just deleted or copied at the cursor".

It's pasting the test I deleted, but I want it to paste the text I just copied from the email.
# 4  
Old 04-11-2013
Copy the email contents, place the cursor in vi where you want to paste the data, go to insert mode and press, shift+insert.

--ahamed
# 5  
Old 04-11-2013
as already said, use the right mouse button (paste) and not esc+p.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to overwrite & before that keep copy a file on many servers

I have ssh password less auth enable & script does the job well as well #/bin/bash for i in `cat ip` do scp /etc/resolv.conf root@$ip done But I need to take backup of the file i will overwrite .. is there any simple way ? Kindly respond (5 Replies)
Discussion started by: heman96
5 Replies

2. Shell Programming and Scripting

Shell script to overwrite a file

Hi Guys, My requirement as follows, i want to write a shell script to display the files of a folder, i export it to a file to mail the file. The problem is the exported file is getting appended every time I run the script. I just want the file to be over written. can anyone suggest?? ... (4 Replies)
Discussion started by: Karthick N
4 Replies

3. UNIX for Dummies Questions & Answers

Overwrite a Source Script Variable Value

Hello All, How do i overwrite a sourced script variable value. Sourced Script: GEN_PARAM_LIST4=""$LOG_DIR"/dwh_GenerateXMLFile.lst" GEN_PARAM_LIST4_v2=""$LOG_DIR"/dwh_GenerateXMLFile.v2.lst" I am using below statement for replacing. Script2: &&... (1 Reply)
Discussion started by: Ariean
1 Replies

4. Shell Programming and Scripting

Using Ex editor commands in a shell script - Help!

Hi all, I am trying to use the Ex editor and its commands in a script - more specifically within an if statement within a while loop. Here are the basics of the loop: cat $file1 | while read line do grep $line $file2 if ] then echo $line > $file2 elseex $file2 /ESI185... (4 Replies)
Discussion started by: luke222010
4 Replies

5. UNIX for Dummies Questions & Answers

Modifying a shell script without using an editor

Hi all, I really wan't to know that how to edit a shell script with out using an editor.. Is there any command? (4 Replies)
Discussion started by: buddhi
4 Replies

6. Shell Programming and Scripting

Overwrite a running shell script

Hello all, This might be a dumb question...but i am running into this situation. I have a shell script that is currently in running state. It has big sql's in it and will run for few days. What happens if I change the shell now? Eg: a.shl is running and i want to mv b.shl a.shl I... (5 Replies)
Discussion started by: gsjdrr
5 Replies

7. UNIX Desktop Questions & Answers

shell overwrite lines in a file

Hello, I have an external file (file.txt). This shall be a kind of a config file for my shell script. I get the line numbers as to a corresponding entry by grep. Now I would like to substitute the corresponding line from the shell script back to the file and exactly on the same line number. ... (4 Replies)
Discussion started by: ACTGADE
4 Replies

8. Shell Programming and Scripting

set EDITOR=vi -> default editor not setting for cron tab

Hi All, I am running a script , working very fine on cmd prompt. The problem is that when I open do crontab -e even after setting editor to vi by set EDITOR=vi it does not open a vi editor , rather it do as below..... ///////////////////////////////////////////////////// $ set... (6 Replies)
Discussion started by: aarora_98
6 Replies

9. UNIX for Dummies Questions & Answers

shell scripts without editor

hello, is there a way that i can produce a shell script without using editors.. i want it to be executable by sh.... my problem is that i dont know how to create the script eg. psycho to put the echo inside to output my message... but i dont want to use editor (12 Replies)
Discussion started by: psychobeauty
12 Replies

10. Shell Programming and Scripting

a script to clone a dir tree, & overwrite the dir struct elsewhere?

hi all, i'm looking for a bash or tcsh script that will clone an empty dir tree 'over' another tree ... specifically, i'd like to: (1) specify a src directory (2) list the directory tree/hiearchy beneath that src dir, w/o files -- just the dirs (3) clone that same, empty dir hierarchy to... (2 Replies)
Discussion started by: OpenMacNews
2 Replies
Login or Register to Ask a Question