unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* unwrapping lines
@ 2007-04-18  5:34 Girish Kulkarni
  2007-04-18  5:45 ` fang.lungang
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Girish Kulkarni @ 2007-04-18  5:34 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

I'm stuck with a curious problem and wonder if I can solve it in
Emacs. I have a data file produced by Mathematica that lists four
quantities. High precision means these numbers tend to be long so
Mathematica often has to truncate lines. It does so by putting in a
backslash and continuing on the next line. For example:

0.17000000000000004 0.10500954682364379 0.20481153067700028 0.309821\
0775006441
0.18000000000000005 0.12459404398470066 0.22952096247531506 0.354115\
0064600157
0.19000000000000006 0.14646262095984275 0.25562017297341694 0.402082\
7939332597

I need to use these data in a Fortran 77 program. But Fortran has
problems reading numbers in that format. In Emacs I can remove that
backslash easily but that doesn't solve my problem. (Fortran then
treats the continued digits as a fifth quantity. This "fifth quantity"
is sometimes present and sometimes absent.)

Is there any way in which I can "unwrap" the lines so that all four
quantities appear in the same line? For example, I want the above to
look like:

0.17000000000000004 0.10500954682364379 0.20481153067700028
0.3098210775006441
0.18000000000000005 0.12459404398470066 0.22952096247531506
0.3541150064600157
0.19000000000000006 0.14646262095984275 0.25562017297341694
0.4020827939332597

I've tried using M-x replace-string with C-q C-d C-q C-d and C-d C-d
to replace "\" with two DELETE characters. Didn't work. Could somebody
help?

Regards,
Girish

--
Girish Kulkarni
Allahabad, India

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: unwrapping lines
  2007-04-18  5:34 unwrapping lines Girish Kulkarni
@ 2007-04-18  5:45 ` fang.lungang
  2007-04-18  5:46 ` Livin Stephen Sharma
       [not found] ` <mailman.2193.1176875480.7795.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 4+ messages in thread
From: fang.lungang @ 2007-04-18  5:45 UTC (permalink / raw)
  To: help-gnu-emacs

On 4月18日, 下午1时34分, Girish Kulkarni <gee...@gmail.com> wrote:
> Hello,
>
> I'm stuck with a curious problem and wonder if I can solve it in
> Emacs. I have a data file produced by Mathematica that lists four
> quantities. High precision means these numbers tend to be long so
> Mathematica often has to truncate lines. It does so by putting in a
> backslash and continuing on the next line. For example:
>
> 0.17000000000000004 0.10500954682364379 0.20481153067700028 0.309821\
> 0775006441
> 0.18000000000000005 0.12459404398470066 0.22952096247531506 0.354115\
> 0064600157
> 0.19000000000000006 0.14646262095984275 0.25562017297341694 0.402082\
> 7939332597
>
> I need to use these data in a Fortran 77 program. But Fortran has
> problems reading numbers in that format. In Emacs I can remove that
> backslash easily but that doesn't solve my problem. (Fortran then
> treats the continued digits as a fifth quantity. This "fifth quantity"
> is sometimes present and sometimes absent.)
>
> Is there any way in which I can "unwrap" the lines so that all four
> quantities appear in the same line? For example, I want the above to
> look like:
>
> 0.17000000000000004 0.10500954682364379 0.20481153067700028
> 0.3098210775006441
> 0.18000000000000005 0.12459404398470066 0.22952096247531506
> 0.3541150064600157
> 0.19000000000000006 0.14646262095984275 0.25562017297341694
> 0.4020827939332597
>
> I've tried using M-x replace-string with C-q C-d C-q C-d and C-d C-d
> to replace "\" with two DELETE characters. Didn't work. Could somebody
> help?
You may try:
M-x query-replace-regexp <ret> \\C-q C-j <ret><ret>
> Regards,
> Girish
>
> --
> Girish Kulkarni
> Allahabad, India

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: unwrapping lines
  2007-04-18  5:34 unwrapping lines Girish Kulkarni
  2007-04-18  5:45 ` fang.lungang
@ 2007-04-18  5:46 ` Livin Stephen Sharma
       [not found] ` <mailman.2193.1176875480.7795.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 4+ messages in thread
From: Livin Stephen Sharma @ 2007-04-18  5:46 UTC (permalink / raw)
  To: emacs-help gnu

Have you tried this:

"M-x replace-string" "\C-o" ""

(without all the quotes)
to replace '\' followed by "new-line" with an empty string ("").


--livin.stephen


 From help on "C-o"
C-o runs the command open-line
   which is an interactive compiled Lisp function in `simple.el'.
It is bound to C-o, <insertline>.
(open-line n)

Insert a newline and leave point before it.
If there is a fill prefix and/or a `left-margin', insert them
on the new line if the line would have been blank.
With arg n, insert n newlines.

On 18-Apr-07, at 11:04 , Girish Kulkarni wrote:

> 0.12459404398470066

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: unwrapping lines
       [not found] ` <mailman.2193.1176875480.7795.help-gnu-emacs@gnu.org>
@ 2007-04-18  6:27   ` Girish Kulkarni
  0 siblings, 0 replies; 4+ messages in thread
From: Girish Kulkarni @ 2007-04-18  6:27 UTC (permalink / raw)
  To: help-gnu-emacs

On Apr 18, 10:46 am, Livin Stephen Sharma <livin.step...@gmail.com>
wrote:
> Have you tried this:
>
> "M-x replace-string" "\C-o" ""
>
> (without all the quotes)
> to replace '\' followed by "new-line" with an empty string ("").

Thank you so much! That worked.

Girish

--
Girish Kulkarni
Allahabad, India

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-04-18  6:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-18  5:34 unwrapping lines Girish Kulkarni
2007-04-18  5:45 ` fang.lungang
2007-04-18  5:46 ` Livin Stephen Sharma
     [not found] ` <mailman.2193.1176875480.7795.help-gnu-emacs@gnu.org>
2007-04-18  6:27   ` Girish Kulkarni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).