Apple - Copying blocks of text in terminal
You should be able to do this by holding the option key down while doing it. This changes the cursor to a '+' sign and allows you to select any rectangular area of text.
See screenshot below:
If you look at the above image closely, you'll see in the left window I've highlighted a block of text in Terminal and in the right window I've been able to paste this text into a new TextEdit document.
When using iTerm2, you can either use Cmd+Option+mouse to perform vertical/block selection, which transforms your cursor into a cross, similar to Terminal.app.
Or you can use copy mode:
- Cmd+Shift+C to enter copy mode
- Ctrl+v to enter vertical/block mode
- Move the cursor using the cursor keys on the keyboard (see link for more movement options)
- Once you’re done, use Ctrl+k, y to copy the selection.
You might also try using awk
to limit the shell output to what you want. You could then even pipe it to pbcopy