Emacs - how to format a block of text in spreadsheet form?

Does emacs have a command / mode for formatting a block of text as follows:

; before ; p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 i 107 0 1 10000 440 1 i 107 1.5 1 20000 220 2 i 107 3 2 10000 110 2 i 107 3.5 2.5 10000 138.6 2 i 107 4 2 5000 329.6 2 i 107 4.5 1.5 6000 440 2 i 108 7 1 10000 440 1 2 3 1 i 108 8.5 1 10000 220 1 0.5 8 1 i 108 10 3 10000 110 1 1 13 1 i 108 10.5 2.5 10000 130.8 1 2.001 8 1 

in it?

 ; after ; p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 i 107 0 1 10000 440 1 i 107 1.5 1 20000 220 2 i 107 3 2 10000 110 2 i 107 3.5 2.5 10000 138.6 2 i 107 4 2 5000 329.6 2 i 107 4.5 1.5 6000 440 2 i 108 7 1 10000 440 1 2 3 1 i 108 8.5 1 10000 220 1 0.5 8 1 i 108 10 3 10000 110 1 1 13 1 i 108 10.5 2.5 10000 130.8 1 2.001 8 1 
+4
source share
3 answers

try Mx table-capture

+4
source

I'm not sure if this is the same, but org-mode has excellent table support.

activate org-mode and try either one of them

  • write a keyboard macro to add '|' between fields (if your tables are not allowed or if there is no empty cell)

  • use regexp-replace to convert space to '|'

then play with him like in excel

ps: if you need more just ask

+1
source

You can use the org-mode emacs table support to create a table from a region, and then remove the column delimiters after it is completed.

Select the area in question, then do

 Mx org-table-create-or-convert-from-region 

Your results will look like this:

 ; before | ; | p1 | p2 | p3 | p4 | p5 | p6 | p7 | p8 | p9 | p10 | | i | 107 | 0 | 1 | 10000 | 440 | 1 | | | | | | i | 107 | 1.5 | 1 | 20000 | 220 | 2 | | | | | | i | 107 | 3 | 2 | 10000 | 110 | 2 | | | | | | i | 107 | 3.5 | 2.5 | 10000 | 138.6 | 2 | | | | | | i | 107 | 4 | 2 | 5000 | 329.6 | 2 | | | | | | i | 107 | 4.5 | 1.5 | 6000 | 440 | 2 | | | | | | i | 108 | 7 | 1 | 10000 | 440 | 1 | 2 | 3 | 1 | | | i | 108 | 8.5 | 1 | 10000 | 220 | 1 | 0.5 | 8 | 1 | | | i | 108 | 10 | 3 | 10000 | 110 | 1 | 1 | 13 | 1 | | | i | 108 | 10.5 | 2.5 | 10000 | 130.8 | 1 | 2.001 | 8 | 1 | | 

At this point you can search and replace | column separator to get

 ; before ; p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 i 107 0 1 10000 440 1 i 107 1.5 1 20000 220 2 i 107 3 2 10000 110 2 i 107 3.5 2.5 10000 138.6 2 i 107 4 2 5000 329.6 2 i 107 4.5 1.5 6000 440 2 i 108 7 1 10000 440 1 2 3 1 i 108 8.5 1 10000 220 1 0.5 8 1 i 108 10 3 10000 110 1 1 13 1 i 108 10.5 2.5 10000 130.8 1 2.001 8 1 
+1
source

All Articles