* RE: emacs for beginners (copy and paste)
@ 2013-04-12 23:28 Buchs, Kevin
0 siblings, 0 replies; 5+ messages in thread
From: Buchs, Kevin @ 2013-04-12 23:28 UTC (permalink / raw)
To: help-gnu-emacs
Welcome to emacs. You haven't said what you would like to do with the
values. One option might be that you want the numbers to be a list of
one number per line. Or, maybe you want the numbers with commas
separating them. In either of these cases, I would suggest you use a
couple of regular expression replacements to transform your given
contents. Position your cursor ("point") before the range. Then enter
M-x (usually that is Alt key held down while you press the x key),
followed by typing: replace-regexp. Press enter. Next you can type this
(carefully match it):
delta_ref: [0-9]+ delta_eff:
Note there is a trailing blank at the end of that line. Next press
enter. Again press enter. Now, repeat this in a similar fashion,
starting with M-x replace-regexp. Enter and
gamma_ref: [0-9]+ gamma_eff:
Note trailing blank. Press enter twice. Now, one more time, this being a
bit more complicated: M-x replace-regexp, enter and:
-+ MOUVEMENT M[0-9]+ -+
Then press Control-q followed by Control-j. Then continue to type:
alpha_ref: [0-9]+ alpha_eff:
Note there is a trailing blank at the end of that line. Now press enter
twice.
Now you should have something like:
11
04
00
15
00
01
...
If you make a mistake at some point, press Control-g to abort. Then you
can also press Control-x followed by Control-u to undo the last change.
Repeat C-x and C-u to undo further back.
Kevin Buchs | Senior Engineer | SPPDG | 507-538-5459 |
buchs.kevin@mayo.edu
Mayo Clinic | 200 First Street SW | Rochester, MN 55905 |
http://www.mayo.edu
^ permalink raw reply [flat|nested] 5+ messages in thread
* emacs for beginners (copy and paste)
@ 2013-04-12 9:47 piconese.as
2013-04-12 19:40 ` Barry Margolin
2013-04-13 8:31 ` Peter Dyballa
0 siblings, 2 replies; 5+ messages in thread
From: piconese.as @ 2013-04-12 9:47 UTC (permalink / raw)
To: help-gnu-emacs
Hi!!! I'm starting to use EMACS and I'have a problem:
I want to copy and paste the values of alpha_eff delta_eff gamma_eff.
The problem is that I want to do this for 75 movements.
So I want to select and to copy only the values of alpha_eff delta_eff gamma_eff for each movement and to paste them in a new file.
Can you help me??
Thanks
--------------- MOUVEMENT M1 -------------
alpha_ref: 11 alpha_eff: 11
delta_ref: 04 delta_eff: 04
gamma_ref: 00 gamma_eff: 00
--------------- MOUVEMENT M2 -------------
alpha_ref: 15 alpha_eff: 15
delta_ref: 00 delta_eff: 00
gamma_ref: 01 gamma_eff: 01
.
.
.
.
--------------- MOUVEMENT M75 -------------
alpha_ref: 116 alpha_eff: 123
delta_ref: 04 delta_eff: 04
gamma_ref: 00 gamma_eff: 00
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: emacs for beginners (copy and paste)
2013-04-12 9:47 piconese.as
@ 2013-04-12 19:40 ` Barry Margolin
2013-04-29 17:43 ` Ken Goldman
2013-04-13 8:31 ` Peter Dyballa
1 sibling, 1 reply; 5+ messages in thread
From: Barry Margolin @ 2013-04-12 19:40 UTC (permalink / raw)
To: help-gnu-emacs
In article <8e85c07f-e123-489d-9575-7de4e6063a86@googlegroups.com>,
piconese.as@gmail.com wrote:
> Hi!!! I'm starting to use EMACS and I'have a problem:
>
> I want to copy and paste the values of alpha_eff delta_eff gamma_eff.
>
> The problem is that I want to do this for 75 movements.
>
> So I want to select and to copy only the values of alpha_eff delta_eff
> gamma_eff for each movement and to paste them in a new file.
Look into keyboard macros. You record a sequence of keyboard commands,
and then tell Emacs to rerun them. You can tell it how many times to run
it over and over.
In your case, you can use a regexp search to search for
\(alpha\|delta\|gamma\)_eff:, set a mark, move over the next word, copy
it with M-w, switch to the buffer containing the file you're copying to,
paste with C-y, and switch back to the original buffer.
>
> Can you help me??
>
> Thanks
>
>
> --------------- MOUVEMENT M1 -------------
> alpha_ref: 11 alpha_eff: 11
> delta_ref: 04 delta_eff: 04
> gamma_ref: 00 gamma_eff: 00
>
> --------------- MOUVEMENT M2 -------------
> alpha_ref: 15 alpha_eff: 15
> delta_ref: 00 delta_eff: 00
> gamma_ref: 01 gamma_eff: 01
> .
> .
> .
> .
> --------------- MOUVEMENT M75 -------------
> alpha_ref: 116 alpha_eff: 123
> delta_ref: 04 delta_eff: 04
> gamma_ref: 00 gamma_eff: 00
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: emacs for beginners (copy and paste)
2013-04-12 19:40 ` Barry Margolin
@ 2013-04-29 17:43 ` Ken Goldman
0 siblings, 0 replies; 5+ messages in thread
From: Ken Goldman @ 2013-04-29 17:43 UTC (permalink / raw)
To: help-gnu-emacs
On 4/12/2013 3:40 PM, Barry Margolin wrote:
> In article <8e85c07f-e123-489d-9575-7de4e6063a86@googlegroups.com>,
> piconese.as@gmail.com wrote:
>
>> Hi!!! I'm starting to use EMACS and I'have a problem:
>>
>> I want to copy and paste the values of alpha_eff delta_eff gamma_eff.
>
> Look into keyboard macros. You record a sequence of keyboard commands,
> and then tell Emacs to rerun them. You can tell it how many times to run
> it over and over.
+1
If you're new to emacs, keyboard macros are the first 'advanced' feature
you want to learn.
There are usually more elegant ways to do things if you want to write
code, but keyboard macros require no coding and are perfect for one-time
automation.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: emacs for beginners (copy and paste)
2013-04-12 9:47 piconese.as
2013-04-12 19:40 ` Barry Margolin
@ 2013-04-13 8:31 ` Peter Dyballa
1 sibling, 0 replies; 5+ messages in thread
From: Peter Dyballa @ 2013-04-13 8:31 UTC (permalink / raw)
To: piconese.as; +Cc: help-gnu-emacs
Am 12.04.2013 um 11:47 schrieb piconese.as@gmail.com:
> I want to copy and paste the values of alpha_eff delta_eff gamma_eff.
(shell-command-on-region (region-beginning) (region-end) "egrep '^[adg]' | awk '{print $NF}'" nil nil "*stderr*" t)
Results can be found in *Shell Command Output*.
Deleting the unnecessary stuff in the buffer or substituting ": " with ":<TAB>" to copy the values as rectangle (with blank lines) seem less efficient.
--
Greetings
Pete
To most people solutions mean finding the answers. But to chemists solutions
are things that are still all mixed up.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-04-29 17:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-12 23:28 emacs for beginners (copy and paste) Buchs, Kevin
-- strict thread matches above, loose matches on Subject: below --
2013-04-12 9:47 piconese.as
2013-04-12 19:40 ` Barry Margolin
2013-04-29 17:43 ` Ken Goldman
2013-04-13 8:31 ` Peter Dyballa
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.