Content

Thoughts on Modelling and Statistics using Gams, Emacs and Stata or R

Emacs Goodies

Tuesday 15 June 2010 - Filed under Emacs

Suppose you have the following information in a text file:
A;410
B;243
C;134
A;410
B;324
C;134
A;410
B;324
C;134
 
and you would like to have this text in the following format
 
       A        410,
       B        243,
 
Emacs makes this a very easy job: Start the macro recording with C-x (  or F3 (the C stands for the Control key) and do the editing of the first line. After you have finished editing the first line, set your cursor at the beginning of the second line and hit C-x ) or F4 (stop recording). Now hit C-x e (start keyboard macro) and Emacs does the second line for you. Keep hitting “e” and it will do the next lines.
If you have 10000 lines like this, hitting the “e” 10000 times might be not a very good option. Instead keep the M key (on windows this is the Alt-key) pressed and punch in 10000 followed by C-x e. Emacs now runs the recorded macro 10000 times.
 

2010-06-15  »  admin

Share your thoughts

Re: Emacs Goodies







Tags you can use (optional):
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>