How to cut half lines into two columns?

  • A+
Category:Languages

I want to change the article ,cut half lines ,paste into two cloumns.

line1 Ipsum dignissimos doloribus line2 Sit odio placeat line3 Consectetur quia line4 Elit adipisicing line5 Adipisicing modi line6 Adipisicing quae line7 Consectetur tempore line8 Adipisicing elit line9 Dolor nam line10 Dolor esse line11 Elit amet line12 Amet quos recusandae   

Trget:

line1 Ipsum dignissimos doloribus     line7 Consectetur tempore line2 Sit odio placeat                line8 Adipisicing elit  line3 Consectetur quia                line9 Dolor nam  line4 Elit adipisicing                line10 Dolor esse line5 Adipisicing modi                line11 Elit amet  line6 Adipisicing quae                line12 Amet quos recusandae  

Please give a simple way with awk or vim.

How to cut half lines into two columns?

My try with vim:

1.move cursor at the 7th line. 2.6dd 3.add many spaces at the end of each line     %s/$/                         / 4.gg  5.move cursor at the middle of the first line 6.ctrl+v 7.6g and down-side arrow 8.I 9.paste content in 0 regitor.     ctrl+r+0 

Failure,can't get what i want.
How to cut half lines into two columns?


To accomplish this in Vim you can pad the first line with trailing spaces, then go to line 7th and enter this key sequence:

<c-v>05j$dgg$p 

Explanation (<c-v> stands for Ctrl-v):

<c-v>05j$dgg$p <c-v>                      " Enter visual-block mode      0                     " Move to beginning of line       5j                   " Move 5 lines below         $                  " Move to last character of line          d                 " Delete visual selection           gg               " Move to first line             $p             " Paste text at the end of the line 

Alternativly enter this in Vim's command line (cursor should be on 7th line):

:exe "norm /<c-v>05j$dgg$p" 

Comment

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: