[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[FR] ob-awk.el specifying a delimeter argument in for output
From: |
Jeremie Juste |
Subject: |
[FR] ob-awk.el specifying a delimeter argument in for output |
Date: |
Sun, 05 Mar 2023 10:50:50 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) |
Hello,
ob-awk has proven very valuable to me lately so many
thanks for maintaining it.
First of all let me specify that I'm a beginner user of awk and I don't
know if I'm using ob-awk as it is intended, so I'll be glad for any
suggestions. Let me explain further:
* Default behavior
If I have a csv file with comma separated values, I get the output as an
org table.
;; test.csv
123,0,123
#+begin_src awk :in-file test.csv :cmd-line -F ","
{print $0}
#+end_src
#+RESULTS:
| 123 | 0 | 123 |
* Request
However If I have a csv file with say semi column delimited values (;)
I don't get the org table as output
#+begin_src awk :in-file test1.csv :cmd-line -F ";"
{print $0}
#+end_src
#+RESULTS:
: 123;0;123
In my opinion, this could be fixed if we could read the :cmd-line
parameter -F and use the delimeter argument ; as a parameter to the
following function
modified lisp/ob-awk.el
@@ -93,7 +93,7 @@ This function is called by `org-babel-execute-src-block'."
results
(let ((tmp (org-babel-temp-file "awk-results-")))
(with-temp-file tmp (insert results))
- (org-babel-import-elisp-from-file tmp)))))
+ (org-babel-import-elisp-from-file tmp ";")))))
Would this be the right way to do think about this issue?
Best regards,
Jeremie
PS Note that we have a samilar issue in ob-shell
where the delimiter is by default a comma.
#+begin_src shell
echo '192;168;1;200' | awk -F ";" '{print $0}'
#+end_src
#+RESULTS:
: 192;168;1;200
#+begin_src shell
echo '192,168,1,200' | awk -F "," '{print $0}'
#+end_src
#+RESULTS:
| 192 | 168 | 1 | 200 |
- [FR] ob-awk.el specifying a delimeter argument in for output,
Jeremie Juste <=