all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Fredrik Bulow <kaliumfredrik@gmail.com>
Subject: Re: replacing endline
Date: Thu, 20 Apr 2006 11:22:56 +1000	[thread overview]
Message-ID: <87y7y1t4zz.fsf@gmail.com> (raw)
In-Reply-To: 1145492327.354125.133060@j33g2000cwa.googlegroups.com

sarah.dzion@gmail.com writes:

> Hi I want to convert :
> 72
> 17
> 18
> 19
> 20
> 21
> 22
> 23
> 24
> 25
>
>
> to
>
> 72#17#18#19#20#21#22#23#24#25
>
> how do I do this using replace-string (or something else in emacs)?
> basically I do not know how to specify endline in emacs.
>
> Appreciate the help!
> Thanks!
> -A

The simplest way to do what you want is to use a macro. You use 
C-x ( to start recording a macro, 
C-x ) to stop recording it and 
C-e to execute the recorded macro

Since I am such a newbie friendly person I'll walk you through the
whole process. Don't be scared because what you see below is a nine
step list. It looks complicated because I explain *everything*. The
process is in fact very simple.

1. Place your marker at the beginning of the second line (i.e. in
   front of or on top of the 1 in 17).

2. Press C-x and then press ( to start recording a macro. Don't hold
   down C-x when you press ), instead, hold down C (which is the key
   marked Ctrl and press x, let both keys up end then press ")" ) 

3. Press backspace. This will take 17 to the line with 72 on it and
   the marker will still be on top of the 1 in 17. The text on this
   line should now be 7217.

4. Press # to type a #. The text on the line is now 72#17

5. Press arrow down (or C-n) to go to the next line.

6. Press C-a to go to the first beginning of that line which is "where
   you started".

7. Pres C-x and then press ) to stop recording the macro.

8. Now press C-x and then e to see the computer automatically do the
   things you've recorded into the macro and bring the 18 up to the
   line with #'s on it.

9. Now you can either press C-x e seven times to finish the rest of
   the lines OR press C-u 7 C-x e which means run macro eight
   times. Now you're done!

Note: when I need to run a macro a few hundred times over, then I
rarely count the lines instead I run the macro 9 times or so a several
times until I can easily see how many more iterations that are needed.

Now you know how to make macros and you can apply this to most
repetitive tasks you need to do during the rest of your life! This
will save you *lots* of time. By the way, you can use all (well
almost) normal emacs commandos in your macros.

Hope this was helpful and good luck!

/Fredrik

  parent reply	other threads:[~2006-04-20  1:22 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-20  0:18 replacing endline sarah.dzion
2006-04-20  1:15 ` Katsumi Yamaoka
2006-04-20  1:17 ` Ye Wenbin
2006-04-20  1:22 ` Fredrik Bulow [this message]
2006-04-20  1:44 ` Fredrik Bulow
2006-04-20  1:56 ` Fredrik Bulow
2006-04-20  6:32   ` Thien-Thi Nguyen
2006-04-20 14:43     ` Fredrik Bulow
2006-04-20 16:11       ` Lennart Borgman
2006-04-20 18:16       ` Eli Zaretskii
2006-04-20 23:38       ` B. T. Raven
     [not found]       ` <mailman.650.1145549499.9609.help-gnu-emacs@gnu.org>
2006-04-20 19:25         ` Harald Hanche-Olsen
2006-04-20 22:19           ` Lennart Borgman
2006-04-21  7:38             ` Eli Zaretskii
     [not found]           ` <mailman.671.1145571606.9609.help-gnu-emacs@gnu.org>
2006-04-21  6:52             ` Harald Hanche-Olsen
2006-04-21  0:53         ` Thien-Thi Nguyen
2006-04-20 10:21   ` Peter Dyballa
2006-04-20 18:54 ` kgold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y7y1t4zz.fsf@gmail.com \
    --to=kaliumfredrik@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.