On Friday, 17 Feb 2017 at 12:33, Roland Everaert wrote:
> Hi,
>
> I am trying to filter a table using the following awk code block.
I think your problem is an error in the awk script; specifically, the
match is outputting all lines because you need to have the { on the same
line as the match expression. Try this:
#+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}/ { You may have noticed that the second line (which had an empty third
print "|"$fstcol"|"$seccol
}
#+END_SRC
column so should not have matched) was also being output when it
shouldn't have.
In any case, the above works for me.
HTH,
eric
--
: Eric S Fraga (0xFFFCF67D), Emacs 26.0.50.1, Org release_9.0.4-242-g2c27b8