Sponsored Content
Top Forums Shell Programming and Scripting Vi / vim - Insert a external command response Post 302991281 by Don Cragun on Wednesday 8th of February 2017 01:00:25 PM
Old 02-08-2017
Try the following sequence of commands:
Code:
/ all<carriage-return>

(where <carriage-return> is entered by hitting the "return" key) This will position the cursor on the space where you want to insert your text.
Code:
s<carriage-return><carriage-return><ESC>

(where <ESC> is entered by hitting the escape key) This will create an empty line where we can insert the output from an external command and leave the cursor on the line after the empty line we just created.
Code:
.-1!echo $HOME<carriage-return>

which will replace the contents of the empty line above where where are sitting with the output produced by the command echo $HOME and leave the cursor on the text that was just replaced.
Code:
kJJ

to move up one line and join the next two lines to that line.

Then continue with other changes you want to make to the file...

PS: Note that the above instructions assume that your cursor is located at the start of the line you mentioned in your post. If that is not where you are sitting, the initial search pattern may need to be more extensive to be sure you locate the proper spot on the proper line.

Last edited by Don Cragun; 02-08-2017 at 02:03 PM.. Reason: Add PS.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

insert escape charactor within VIM

Hi, I need to send "^[" command to the buffer. I tried to use insert within VIM and press 'ctrl' key and then '^' and '[' key. but it didn't work. Does anyone know how to do it? Thanks a lot! Julie (2 Replies)
Discussion started by: cin2000
2 Replies

2. AIX

VI questions : mass changes, mass delete and external insert

Is it possible in VI to do a global change but take the search patterns and the replacement patterns from an external file ? I have cases where I can have 100,200 or 300+ global changes to do. All the new records are inside a file and I must VI a work file to change all of them. Also, can... (1 Reply)
Discussion started by: Browser_ice
1 Replies

3. UNIX for Dummies Questions & Answers

'less' command response is garbled

Helo , I m using RHEL 4. If I run 'ls -laF | more', response is properly display. but when I run If I run 'ls -laF | less', the response is garbled what to do to remove this? Regards, Amit (4 Replies)
Discussion started by: amitpansuria
4 Replies

4. UNIX for Dummies Questions & Answers

vi/vim insert behaviors

While using vi or vim on different boxes, I experience different behaviors when I'm inserting (i) or writing on a new line (o). On the Linux box, I can insert and delete with my backspacekey while in the insert mode. It acts a little more like pico,nedit, etc. On the SunOS box, it's a headache... (3 Replies)
Discussion started by: mrwatkin
3 Replies

5. Shell Programming and Scripting

Insert external variable in a AWK pattern

Dear all, ¿How can i insert a variable in a AWK pattern? I have almost succeeded in solving a puzzle with AWK but now i want to make a script. Let me explain. cat file.txt | awk 'BEGIN {RS="\\n\\n"} /tux/ { print "\n"$0 }' I know that this command makes right what i want to do, but mi... (8 Replies)
Discussion started by: antuan
8 Replies

6. Shell Programming and Scripting

scp command and no response

I should trasfer some files by xxx.xxx.xxx.xxx to local host. In order to check the function works i tried to transfer a single file and I typed: scp -P 21 username@xxx.xxx.xxx.xxx:/filename.nas /filename.nas At this point i haven't response anch i have to type CTRL+C to return to... (2 Replies)
Discussion started by: andreac81
2 Replies

7. UNIX for Dummies Questions & Answers

Vim external command output to new buffer

Hi, From inside Vim, I'm looking for a way to use the contents of the current buffer, pass it to an external executable, and then return the output from the executable into a new Vim buffer. I know that I can do something like %!<executable>, but that will overwrite the contents of the... (3 Replies)
Discussion started by: konfushus
3 Replies

8. Shell Programming and Scripting

[awk] - how to insert an external variable

I want to incorporate the variable in the for statement as a column of my processed file. In the INCORRECT example below, it is $i which corresponds to the i in my for loop: for i in x86_64 i686; do awk '{ print $1" "$4" "$5" "$i }'awk $file-$i > processed-$i.log doneThanks! (3 Replies)
Discussion started by: graysky
3 Replies

9. Shell Programming and Scripting

WGET command retrying to get response

Hi , Iam using " WGET " command to hit the URL,i.e. servlet url. I can trigger the servlet using wget but when servlet is not responding this command retries automatically until it get the positive response from the server. So this script is running for more than 8 hrs to get the positive... (2 Replies)
Discussion started by: vinothsekark
2 Replies

10. UNIX for Beginners Questions & Answers

Shell vim defaulting to Insert or Command mode

On a daily basis I need to SSH into several different RHEL servers using Putty. On some of the servers, if I up arrow to get a previous command, it automatically starts in Input Mode, so if I press up arrow, then 'x' it will type the letter x at the end of the command line. On other servers, it... (4 Replies)
Discussion started by: derndingle
4 Replies
FANN_TRAIN_EPOCH(3)							 1						       FANN_TRAIN_EPOCH(3)

fann_train_epoch - Train one epoch with a set of training data

SYNOPSIS
float fann_train_epoch (resource $ann, resource $data) DESCRIPTION
Train one epoch with the training data stored in data. One epoch is where all of the training data is considered exactly once. This function returns the MSE error as it is calculated either before or during the actual training. This is not the actual MSE after the training epoch, but since calculating this will require to go through the entire training set once more. It is more than adequate to use this value during training. The training algorithm used by this function is chosen by fann_set_training_algorithm(3) function. PARAMETERS
o $ann -Neural network resource. o $data -Neural network training data resource. RETURN VALUES
The MSE, or FALSE on error. SEE ALSO
fann_train_on_data(3), fann_test_data(3), fann_get_MSE(3), fann_set_training_algorithm(3). PHP Documentation Group FANN_TRAIN_EPOCH(3)
All times are GMT -4. The time now is 05:05 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy