I have a vi file containing hundreds of lines with the following format
029.inp.log: SCF Done: E(RHF) = -844.790844670 A.U. after 26 cycles
I want to delete all of the columns (separated by spaces/tabs. got messed up when I pasted it here) other than the first (029.inp.log:) and the fifth (-844.790844670). Can anyone help me?
Start visual-block by Ctrl+v . Select second column (e.g. by pressing: W , G ). Delete it by pressing d .
Use the colrm command to remove specified columns from a file. Input is taken from standard input. Output is sent to standard output. If the command is called with one parameter, the columns of each line from the specified column to the last column are removed.
To delete one character, position the cursor over the character to be deleted and type x . The x command also deletes the space the character occupied—when a letter is removed from the middle of a word, the remaining letters will close up, leaving no gap. You can also delete blank spaces in a line with the x command.
Press ctrl+v
for block selection. use h, j, k, l
keys to navigate and press key d
to delete the selected block. The graphical editor like kate
also having capability of the block selection.
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