emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Handling conversion of fields with spaces to tables
@ 2021-12-06 14:19 Loris Bennett
  2021-12-06 14:36 ` Eric S Fraga
  0 siblings, 1 reply; 6+ messages in thread
From: Loris Bennett @ 2021-12-06 14:19 UTC (permalink / raw)
  To: Org Mode Mailing List

Hi,

I have a script which I call on a remote server which produces
pipe-separated data like:

  marie|Curie|123
  louis|De Broglie|456

However, when I output this to an org table, the field with a space gets
split into two cells in the result.

The same effect can be seen with the following:  

  #+BEGIN_SRC sh 
  echo "marie|Curie|123"
  echo "louis|De Broglie|456"
  #+END_SRC

  #+RESULTS:
  | marie | Curie |     123 |     |
  | louis | De    | Broglie | 456 |

What's the best way of dealing with this situation?

Cheers,

Loris

Emacs 26.1, Org 9.4.6

-- 
This signature is currently under construction.


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

* Re: Handling conversion of fields with spaces to tables
  2021-12-06 14:19 Handling conversion of fields with spaces to tables Loris Bennett
@ 2021-12-06 14:36 ` Eric S Fraga
  2021-12-06 14:43   ` Loris Bennett
  0 siblings, 1 reply; 6+ messages in thread
From: Eric S Fraga @ 2021-12-06 14:36 UTC (permalink / raw)
  To: Loris Bennett; +Cc: Org Mode Mailing List

This might work for you:

  #+BEGIN_SRC sh :results output raw


-- 
: Eric S Fraga, with org release_9.5.1-243-gad53c5 in Emacs 29.0.50
: Latest paper written in org: https://arxiv.org/abs/2106.05096


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

* Re: Handling conversion of fields with spaces to tables
  2021-12-06 14:36 ` Eric S Fraga
@ 2021-12-06 14:43   ` Loris Bennett
  2021-12-06 15:10     ` Eric S Fraga
  0 siblings, 1 reply; 6+ messages in thread
From: Loris Bennett @ 2021-12-06 14:43 UTC (permalink / raw)
  To: Org Mode Mailing List

Hi Eric,

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> This might work for you:
>
>   #+BEGIN_SRC sh :results output raw

That's solves the problem of the field being split, but gives me the new
problem that the output is no longer a table :-)

To elaborate: My goal is to combine this output with data from another
table to create a third table.

Cheers,

Loris

-- 
This signature is currently under construction.


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

* Re: Handling conversion of fields with spaces to tables
  2021-12-06 14:43   ` Loris Bennett
@ 2021-12-06 15:10     ` Eric S Fraga
  2021-12-07  7:09       ` Loris Bennett
  0 siblings, 1 reply; 6+ messages in thread
From: Eric S Fraga @ 2021-12-06 15:10 UTC (permalink / raw)
  To: Loris Bennett; +Cc: Org Mode Mailing List

On Monday,  6 Dec 2021 at 15:43, Loris Bennett wrote:
> That's solves the problem of the field being split, but gives me the new
> problem that the output is no longer a table :-)

Ah, yes, sorry: you need to have each line of the output start with a
"|" as well.  If your external script can do that, it should work.

As in:

  #+BEGIN_SRC sh :results output raw
  echo "|marie|Curie|123"
  echo "|louis|De Broglie|456"
  #+END_SRC

  #+RESULTS:
  | marie | Curie      | 123 |
  | louis | De Broglie | 456 |

-- 
: Eric S Fraga, with org release_9.5.1-243-gad53c5 in Emacs 29.0.50
: Latest paper written in org: https://arxiv.org/abs/2106.05096


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

* Re: Handling conversion of fields with spaces to tables
  2021-12-06 15:10     ` Eric S Fraga
@ 2021-12-07  7:09       ` Loris Bennett
  2021-12-07 10:55         ` Eric S Fraga
  0 siblings, 1 reply; 6+ messages in thread
From: Loris Bennett @ 2021-12-07  7:09 UTC (permalink / raw)
  To: Org Mode List

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> On Monday,  6 Dec 2021 at 15:43, Loris Bennett wrote:
>> That's solves the problem of the field being split, but gives me the new
>> problem that the output is no longer a table :-)
>
> Ah, yes, sorry: you need to have each line of the output start with a
> "|" as well.  If your external script can do that, it should work.
>
> As in:
>
>   #+BEGIN_SRC sh :results output raw
>   echo "|marie|Curie|123"
>   echo "|louis|De Broglie|456"
>   #+END_SRC
>
>   #+RESULTS:
>   | marie | Curie      | 123 |
>   | louis | De Broglie | 456 |

For what ever reason, the external script has an option to add "|" at
the end of each line, but not at the beginning.  However, I can just
pipe the output through 'sed' to get one at the beginning, so all is
well.

Thanks for the help!

Cheers,

Loris
-- 
This signature is currently under construction.


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

* Re: Handling conversion of fields with spaces to tables
  2021-12-07  7:09       ` Loris Bennett
@ 2021-12-07 10:55         ` Eric S Fraga
  0 siblings, 0 replies; 6+ messages in thread
From: Eric S Fraga @ 2021-12-07 10:55 UTC (permalink / raw)
  To: Loris Bennett; +Cc: Org Mode List

On Tuesday,  7 Dec 2021 at 08:09, Loris Bennett wrote:
> However, I can just pipe the output through 'sed' to get one at the
> beginning, so all is well.

Excellent!  sed is one of the most underrated tools in our arsenal and
actually highlights the great thing about org being all about text.

-- 
: Eric S Fraga, with org release_9.5.1-243-gad53c5 in Emacs 29.0.50
: Latest paper written in org: https://arxiv.org/abs/2106.05096


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

end of thread, other threads:[~2021-12-07 10:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-06 14:19 Handling conversion of fields with spaces to tables Loris Bennett
2021-12-06 14:36 ` Eric S Fraga
2021-12-06 14:43   ` Loris Bennett
2021-12-06 15:10     ` Eric S Fraga
2021-12-07  7:09       ` Loris Bennett
2021-12-07 10:55         ` Eric S Fraga

Code repositories for project(s) associated with this inbox:

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

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).