[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [FR] ob-awk.el specifying a delimeter argument in for output

From: Jeremie Juste
Subject: Re: [FR] ob-awk.el specifying a delimeter argument in for output
Date: Mon, 06 Mar 2023 08:36:14 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux)

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)

#+RESULTS: specific-delim

#+begin_src awk :in-file test.csv :cmd-line -F ";" :post specific-delim(*this*)
 {print $0}

: 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,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]