Vi Editor - How to paste the line concatenated with current line


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Vi Editor - How to paste the line concatenated with current line
# 1  
Old 06-30-2010
Vi Editor - How to paste the line concatenated with current line

I generally use yy to copy a line and then p to paste the line at end of current line.

But is there a way to paste the copied line in concatenation with the current line with out going to next line.
# 2  
Old 06-30-2010
I am not sure if there is a direct command for that. I always just use
Code:
p <arrow up> J

or
Code:
p <arrow up> gJ

If I do not want the extra space.
# 3  
Old 06-30-2010
instead of yy, copy the current line using y$ ( but you should be at the starting position to copy the line )..

go to the position where you want to paste, and press p to paste .. ( so it will not go to the next line also )
This User Gave Thanks to thegeek For This Post:
# 4  
Old 06-30-2010
CPU & Memory

Quote:
Originally Posted by paragkalra
I generally use yy to copy a line and then p to paste the line at end of current line.

But is there a way to paste the copied line in concatenation with the current line with out going to next line.
Go to first character of the line.
Press ESC then v then go to the end of line.
Press y and go to the last character of the line.
Press p.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Copy Column Value Of Next Line Into Current Line

Hello All, I am looking for help to achieve the following: Here is the data set 1757890237|42|55570025|1468796400|0 1757890237|32|55570025|1471474800|0 1757890237|54|55570025|1474153200|1476745200 1757890237|34|55570026|1468796400|0 1757890237|44|55570026|1471474800|0... (7 Replies)
Discussion started by: angshuman
7 Replies

2. Shell Programming and Scripting

Append Next line with current Line bassed on condition

Hi, I have an XML file and I am tring to extract some data form it, after lot of data cleaning process, I ended up with an issue, and need your urgent support. my current input data in below format: <Node>xxxxxx <Node>yyyyy</Node> <Node>zzzzzz <Node>12345</node> I need... (9 Replies)
Discussion started by: rramkrishnas
9 Replies

3. UNIX for Dummies Questions & Answers

Printing the next line side by to the current line

Help, I have a text file which looks like disco 5674536 3456 jambo disco 453678 4578 jambo I would like to have an output which looks like below disco 3456 disco 4578 (4 Replies)
Discussion started by: Indra2011
4 Replies

4. Shell Programming and Scripting

Find in the current line and next line.

Hi, I have lines that have pattern like this. 1) productFamilyGroupIndex < Local.ProductFamilyGroup.capacity)) and 2) if (local.getProductFamilyGroup().size() >= Local.ProductFamilyGroup. capacity) So, If I need to find the pattern grep '\(< \|>= \)Local.*capacity'... (4 Replies)
Discussion started by: srikanthradix
4 Replies

5. Shell Programming and Scripting

Sed Comparing Parenthesized Values In Previous Line To Current Line

I am trying to delete lines in archived Apache httpd logs Each line has the pattern: <ip-address> - - <date-time> <document-request-URL> <http-response> <size-of-req'd-doc> <referring-document-URL> This pattern is shown in the example of 6 lines from the log in the code box below. These 6... (1 Reply)
Discussion started by: Proteomist
1 Replies

6. Shell Programming and Scripting

Copy some line and paste it after some line in same file

Hi, I want to know how I can copy line 6th to 10th and paste it after 17th line in same file. Thanks, Biplab (19 Replies)
Discussion started by: Biplab
19 Replies

7. UNIX for Dummies Questions & Answers

vim copy line and paste at the beginning, middle, and end of another line

How would you do vim copy line and paste at the beginning, middle, and end of another line. I know yy copies the whole line and p pastes the whole line, but on its own separate line. Sometimes I would like to copy a line to the beginning, middle, or end of another line. I would think this would be... (3 Replies)
Discussion started by: cokedude
3 Replies

8. Shell Programming and Scripting

Paste every other line?

Hi! I have two files that look like this: File1 A B C D E F ... File2 Z Y X W V U (4 Replies)
Discussion started by: Limmnes
4 Replies

9. Shell Programming and Scripting

Can't paste in command line.

Hello. I've made a simple script which asks the user to input a hash and then runs a command that replaces the variable $hash with what the user inserted. The ting is that when the programm asks for input I can't paste anything there..! any clues?? :wall: (8 Replies)
Discussion started by: louboulos
8 Replies

10. Shell Programming and Scripting

awk print the next line on the current line

Ok I have a file with hundreds of lines, four columns, space delimited, TESTB.TXT for example TESTB.TXT --- AA ZZ 12 34 BB YY 56 78 CC XX 91 23 DD VV 45 67 --- I want a new file that has 7 columns, the first four are identical, and the next 3 are the last three of the next line...so... (5 Replies)
Discussion started by: ajp7701
5 Replies
Login or Register to Ask a Question