emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] org babel table header sent to awk code block


From: Roland Everaert
Subject: [O] org babel table header sent to awk code block
Date: Fri, 17 Feb 2017 13:33:39 +0100

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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]