emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Roland Everaert <reveatwork@gmail.com>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: org babel table header sent to awk code block
Date: Fri, 17 Feb 2017 13:33:39 +0100	[thread overview]
Message-ID: <CACdPZ9+ucgvXP5dokasbq9pmLowkgA6tR97tJy+mx9Ri2ETgLw@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 927 bytes --]

Hi,

I am trying to filter a table using the following awk code block.
#+BEGIN_SRC awk :stdin list-example :var fstcol=1 :var seccol=3 :results
output org
  BEGIN {
  print "|Host|Result"
  print "|-"
  }
  $seccol ~ /[0-9]{1,3}(\.[0-9]\{1,3\}){3}/
  {
  print "|"$fstcol"|"$seccol
  }
#+END_SRC

The input table:

    #+NAME: list-example
    | A      |            B |            C |
    |--------+--------------+--------------|
    | blabla |  12.147.5.74 | 10.23.31.189 |
    | test   |  147.12.5.74 |              |
    | hello  | 79.147.64.74 | 10.23.31.189 |


And the result is:


#+RESULTS:
#+BEGIN_SRC org
| Host   |       Result |
|--------+--------------|
| A      |            C |
| blabla | 10.23.31.189 |
| test   |              |
| hello  | 10.23.31.189 |
#+END_SRC


Why the column names of the table are sent to awk?

I have tried to set :colnames and :hlines, but that doesn't change the
behavior.


Regards.

[-- Attachment #2: Type: text/html, Size: 1310 bytes --]

             reply	other threads:[~2017-02-17 12:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-17 12:33 Roland Everaert [this message]
     [not found] <48db0e51591f4ff180507a99ea72ad5a@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2017-02-17 13:08 ` org babel table header sent to awk code block Eric S Fraga
2017-02-17 15:00   ` Roland Everaert

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=CACdPZ9+ucgvXP5dokasbq9pmLowkgA6tR97tJy+mx9Ri2ETgLw@mail.gmail.com \
    --to=reveatwork@gmail.com \
    --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).