Ok, so I have 2 files with a lot of data in columns that I need join. I'm finding it hard to put into words so let me try and give an example.
File 1 contains:
Server1; 15min load 0.20 at 16 CPUs;
Server2; 15min load 0.46 at 4 CPUs;
Server3; 15min load 0.10 at 16 CPUs;
...
File 2 contains:
72.4% (12.01)
73.9% (12.26)
72.1% (11.97)
...
What I need is:
Server1; 15min load 0.20 at 16 CPUs; 72.4% (12.01)
Server2; 15min load 0.46 at 4 CPUs; 73.9% (12.26)
Server3; 15min load 0.10 at 16 CPUs; 72.1% (11.97)
...
The dots represent thousands more lines hence the need for automation. I've tried everything that might work:
I've somehow done this before but am now struggling to replicate.
I'm aware this can be done in shell script but I'm really curious as to how Sublime text manages it.
Thanks in advance!
Multi-line editing. Most commonly I use cmd+d to select the next instance of selected text. In the animation below I select the first instance (with alt+shift+left ), then press cmd+d to select the next instance. If you want to skip an instance you can press cmd+k, cmd+d .
Go to the file2, press:
Ctrl+A, Ctrl+c (select all, then copy)
...
Then go the the file1 and press in sequence:
Ctrl+a, Ctrl+Shift+L, →, Space, Ctrl+v (select all, split into lines, move cursor to the end of each line, insert a space, paste the contents.
The answer outlined by @HugoCorrá does still work in Sublime 3 on Windows 8. But you MUST make sure that the number of lines selected, matches the number of lines to paste or it does not work (it will paste a copy of the whole clipboard in each selection).
Alternatively use the text pastry plugin for Sublime, a really nice tool for multi-line pasting. The difference being, you select the text to paste with a standard CTRL + A Ctrl + C. Then select all the paste points in the second document (as @HugoCorrá specified), but don't do a Ctrl + V. Instead use text pastry Ctrl + Alt + N. Then in the command prompt use \p
to paste from the clipboard.
An example is given here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With