Consider this case: I have some data which looks like this:
1.9170000e+03 $ 1.6909110e+00
1.4550000e+03 $ 1.7775459e+00
1.1800000e+03 $ 1.8771469e+00
1.0000000e+03 $ 1.9992190e+00
8.7500000e+02 $ 2.1938025e+00
7.8300000e+02 $ 2.5585915e+00
Note that the dollar sign separating the two column may be any character (ranging from a certain number of spaces, the \t (tab) char, a comma or just about any character that is uniquely used for the purpose of separating column. Also note that the data may have more than two columns.
Now I'd like to reformat the block of data such that all items from a certain column are listed in a single row (separated by the char that I marked as $ in the above example): The items from column 0 fill row 0, the items from column 1 fill row 1 and so on.
Is there a predefined emacs function to do that? Or if not, is there some "self-rolled" function to achieve that?
Also I'm very interested in a function that does the reverse thing, i.e. take some lines and put them in the column structure.
Any help is much appreciated!
Here's how you can transpose cell content: Copy the cell range. Select the empty cells where you want to paste the transposed data. On the Home tab, click the Paste icon, and select Paste Transpose.
You can use csv-mode
(available from package.el
). This is a simple transpose operation. To do so customize the value of csv-separators
to '("$")
and then use C-c C-t.
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