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.