Question

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

Thanks!

Was it helpful?

Solution

You can delete a rectangle with delete-rectangle (C-x r d) or kill-rectangle (C-x r k). Either one will kill the rectangle with corners defined by the point and the mark. kill-rectangle will also save it for yanking with yank-rectangle.

OTHER TIPS

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

From the documentation:

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

Execute string COMMAND in inferior shell with region as input. Normally display output (if any) in temp buffer `Shell Command Output'; Prefix arg means replace the region with it. Return the exit code of COMMAND. [...]

Note the bit about the prefix arg (C-u).

Tip: C-x h will set the region to your whole buffer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top