emacs-orgmode
[Top][All Lists]
Advanced

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

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


From: Roland Everaert
Subject: Re: [O] org babel table header sent to awk code block
Date: Fri, 17 Feb 2017 16:00:52 +0100

I see that more or less 30 seconds after posting to the ML :/

So the problem of this script is solved.

But anyway, why are column headers sent to the script, even with :hlines and/or :colnames set approriately?

Thanks.

On Fri, Feb 17, 2017 at 2:08 PM, Eric S Fraga <address@hidden> wrote:
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}/ {
  print "|"$fstcol"|"$seccol
  }
#+END_SRC

You may have noticed that the second line (which had an empty third
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


reply via email to

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