Removing specific columns of text in Emacs / XEmacs using the keyboard

Is it possible to delete specific columns of text (i.e. specific column numbers) in Emacs / XEmacs using only the keyboard? I know that you can select a rectangle of text with the mouse (or the arrow keys), but for a 1 millionth text file this can be quite time consuming.

Thanks!

+8
text gnu emacs xemacs
source share
2 answers

You can delete a rectangle with delete-rectangle ( Cx rd ) or kill-rectangle ( Cx rk ). Any of them will kill a rectangle with angles defined by a point and a label. kill-rectangle also save it for yanking with yank-rectangle .

+10
source share

If you have sed or awk on your system, you can conveniently use Cu M-| .

From the documentation:

M- | runs the command shell-command-on-region [...]

Run the command line in the lower shell with the region as input. Usually the display output (if any) in the `Shell Command Output 'temporary buffer; The arg prefix means replacing a region with it. Return the exit code from the TEAM. [...]

Note the bit about the arg ( Cu ) prefix.

Tip: Cx h set the region to your entire buffer.

+1
source share

All Articles