From: Jeremie Juste <jeremiejuste@gmail.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: emacs-orgmode@gnu.org, tyler@plantarum.ca
Subject: Re: [FR] ob-awk.el specifying a delimeter argument in for output
Date: Mon, 06 Mar 2023 08:36:14 +0100 [thread overview]
Message-ID: <877cvus55d.fsf@gmail.com> (raw)
In-Reply-To: <87bkl7z84p.fsf@localhost> (Ihor Radchenko's message of "Sun, 05 Mar 2023 12:37:42 +0000")
Hello Ihor,
> Org knows nothing about your output, by default.
> You could as well do something like {print $1+-+$2+-+$3}
> What should Org do in such case?
>
> Currently, Org tries to guess the type of arbitrary output. If the
> output looks like a table, with fields separated by tabs, commas, or
> spaces, it converts the output to table. Otherwise, it is treated as
> string.
Many thanks for the insights. Ok, I guess this it likely to take some
time, but it would be a great feature in my option.
>
> I guess we might add an option to tell Org which separator to use when
> parsing output when :results table header argument is provided (see 16.6
> Results of Evaluation section of Org manual). However, you can achieve
> the same now, using :post header argument, replacing the separators with
> something Org can understand.
Thanks for the suggestion. I tried using post replacing semi columns by
commas but was surprised by the output.
# file test.csv
# 123;0;123
#+NAME: specific-delim
#+BEGIN_SRC emacs-lisp :var tbl=""
(replace-regexp-in-string ";" "," tbl)
#+end_src
#+RESULTS: specific-delim
#+begin_src awk :in-file test.csv :cmd-line -F ";" :post specific-delim(*this*)
{print $0}
#+end_src
#+RESULTS:
: 123,0,123
After a short investigation, I notice that the function
org-babel-import-elisp-from-file, is the function making the call wheter
the result should be a table or not i.e before the :post argument. Have
I understood correctly?
If it is the case, then I would have to not just replace the delimeter
but convert the entire results to an org-table.
Best regards,
Jeremie
next prev parent reply other threads:[~2023-03-06 7:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-05 9:50 [FR] ob-awk.el specifying a delimeter argument in for output Jeremie Juste
2023-03-05 12:37 ` Ihor Radchenko
2023-03-06 7:36 ` Jeremie Juste [this message]
2023-03-06 7:47 ` Jeremie Juste
2023-03-06 10:00 ` Max Nikulin
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
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877cvus55d.fsf@gmail.com \
--to=jeremiejuste@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=tyler@plantarum.ca \
--cc=yantar92@posteo.net \
/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 public 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).