Emacs Goodies

Often you have to repeat a series of keystrokes. That is probably boring if the number of repetitions is low, but gets really annoying if the number gets higher. A typical example is formatting data or text. Take the following text snippet where we have data coming from a comma separated 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.