all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [FR] ob-awk.el specifying a delimeter argument in for output
@ 2023-03-05  9:50 Jeremie Juste
  2023-03-05 12:37 ` Ihor Radchenko
  2023-03-06 10:00 ` Max Nikulin
  0 siblings, 2 replies; 5+ messages in thread
From: Jeremie Juste @ 2023-03-05  9:50 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: tyler

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 |


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

end of thread, other threads:[~2023-03-06 10:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2023-03-06  7:47     ` Jeremie Juste
2023-03-06 10:00 ` Max Nikulin

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.