emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Cook, Malcolm" <MEC@stowers.org>
To: Org-mode <emacs-orgmode@gnu.org>
Subject: How to emulate `#+begin_src sh :output table :colnames yes`  ?
Date: Fri, 31 Jan 2025 16:35:23 +0000	[thread overview]
Message-ID: <DS7PR20MB46712959CF0CF62BD4393182BEE82@DS7PR20MB4671.namprd20.prod.outlook.com> (raw)

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

                 reply	other threads:[~2025-01-31 16:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=DS7PR20MB46712959CF0CF62BD4393182BEE82@DS7PR20MB4671.namprd20.prod.outlook.com \
    --to=mec@stowers.org \
    --cc=emacs-orgmode@gnu.org \
    /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).