I would like to remove the content for all lines between two columns. How do I do this?
For example, I want this:
abcdefg
hijklmn
opqrstu
To become this if I remove text between columns 3 through 5:
abfg
himn
optu
=LEFT(B3,LEN(B3)-1) The LEFT function returns the first characters, counting from the left end of the text string. The number of characters is given by the LEN function. LEN(B3)-1 means we remove 1 character from the value in B3 which is T6642. The resulting string minus the last character is T664.
Remove Text After a Character Using Find and Replace If you want to quickly remove all the text after a specific text string (or before a text string), you can do that using Find and Replace and wild card characters.
Position your cursor in d, then press Ctrl-V
, l
, G
and d
.
Ctrl-v
enters visual block mode;l
expands the visual selection one character to the right;G
expands the selection to the last line;d
deletes the selection.Your question is very similar to this one.
To delete the columns 3 through 5 for all lines in the file:
:%normal 3|d6|
In order to delete an specific line interval (80 to 90), use this:
:80,90normal 3|d6|
If you're not familiar with the normal command nor with the | "motion" there goes a quick explanation:
normal
command execute the following commands in the normal mode;3|
moves the cursor to the 3rd column;d
) until the 5th column (6|
).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