Skip to main content
Tweeted twitter.com/StackUnix/status/819579241985699841
added 35 characters in body; edited tags
Source Link
terdon
  • 252.3k
  • 69
  • 480
  • 718

I have some file like this :

abc 123
abc 789
bcd 456
acb 135

abc 123    
abc 789  
bcd 456  
acb 135

I would like to print first column of next line in current line.

Desired output:

abc 123 abc
abc 789 bcd
bcd 456 acb
acb 135

abc  123 abc  
abc 789 bcd  
bcd 456 acb  
acb 135 

I prefer to use awk.

I have some file like this :

abc 123
abc 789
bcd 456
acb 135

I would like to print first column of next line in current line.

Desired output:

abc 123 abc
abc 789 bcd
bcd 456 acb
acb 135

I prefer to use awk.

I have some file like this :

abc 123    
abc 789  
bcd 456  
acb 135

I would like to print first column of next line in current line.

Desired output:

abc  123 abc  
abc 789 bcd  
bcd 456 acb  
acb 135 

I prefer to use awk.

Source Link
user2905046
  • 305
  • 1
  • 4
  • 10

How to print first column of next line in current line?

I have some file like this :

abc 123
abc 789
bcd 456
acb 135

I would like to print first column of next line in current line.

Desired output:

abc 123 abc
abc 789 bcd
bcd 456 acb
acb 135

I prefer to use awk.