emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to emulate `#+begin_src sh :output table :colnames yes`  ?
@ 2025-01-31 16:35 Cook, Malcolm
  0 siblings, 0 replies; only message in thread
From: Cook, Malcolm @ 2025-01-31 16:35 UTC (permalink / raw)
  To: Org-mode

Is there any best approach to formatting output of bash or shell code block as an org table whose first line is a header.

What I've tried:

#+begin_src bash :colnames yes :results output table 
echo "Name,Age"
echo "Alice,30"
echo "Bob,25"
#+end_src

#+RESULTS:
| Name  | Age |
| Alice |  30 |
| Bob   |  25 |

Granted the org doc does 
I would use :post to inject a 2nd line if I knew what to inject to have it be treated as separator between header and body of an org table

But I can't even figure that out.  I've tried a few variations on the following none of which work in my hands.

#+begin_src bash :colnames yes :hline yes  :results output table 
echo "Name,Age"
echo "-,-"
echo "Alice,30"
echo "Bob,25"
#+end_src

#+RESULTS:
| Name  | Age |
| -     |   - |
| Alice |  30 |
| Bob   |  25 |


It seems the issue has been raised and not completely addressed here:

http://eschulte.github.io/babel-dev/DONE-Handling-of-table-column-names-and-hlines-across-languages

I would really like an approach which constructs output to be true ORG table which I can then feed to other downstream org tools that work with org table.

Thanks!

~Malcolm

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-01-31 16:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-31 16:35 How to emulate `#+begin_src sh :output table :colnames yes` ? Cook, Malcolm

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