Separating lines into fields in Emacs

I have the following data

Food $44 Transport $52 Rentals $102 ... 

I want to convert to the next

 Food $44 Transport $52 Rentals $102 ... 

Is there a built-in function in Emacs for this? I am not familiar with elisp. Thanks.

+4
source share
2 answers

A few possibilities. The simplest is probably Cu Mx align. Cm.

http://www.emacswiki.org/emacs/AlignCommands

Another option is to use table mode. Just grab the table Mx, use one space as a column and a new row (Cq Cj) as a line separator. Subsequently, you can use Mx table-release to get rid of the rows. For more information see

http://www.emacswiki.org/emacs/TableMode

(and the Emacs manual, of course).

+7
source

One of the emacs alignment commands should do the job.

Start with Cu Mx align after selecting the region you want to line up.

+1
source

All Articles