File #1:
F#1 A1 B1 C1
F#1 A2 B2 C2
F#1 A3 B3 C3
F#1 A4 B4 C4
F#1 A5 B5 C5
F#1 A6 B6 C6
File #2:
D1 E1 F1
D2 E2 F2
D3 E3 F3
D4 E4 F4
D5 E5 F5
D6 E6 F6
The wanted format in File#2:
F#1 D1 E1 F1
F#1 D2 E2 F2
F#1 D3 E3 F3
F#1 D4 E4 F4
F#1 D5 E5 F5
F#1 D6 E6 F6
In vim, how to copy the entire column (1st column in this example) from File #1 to File #2, as in the wanted format shown above? Note that, in reality, the file is very long.
Thank you.
Blockwise visual mode ( CTRL-v
) can help you achieving this ( :help v
for documentation).
The sequence of commands should be:
CTRL-v
. You should be in "VISUAL BLOCK" mode.G
- it will take you to the end of file.l
to mark the column (4 times in this case). Press y
to copy this column.
Open the second file ( :e <second-filename>
).
Go to the top left corner and press P
to paste the column.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.