From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric S Fraga Subject: Re: org babel table header sent to awk code block Date: Fri, 17 Feb 2017 13:08:52 +0000 Message-ID: <87shndc6cb.fsf@ucl.ac.uk> References: <48db0e51591f4ff180507a99ea72ad5a@HE1PR01MB1898.eurprd01.prod.exchangelabs.com> Reply-To: Eric S Fraga Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53985) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cejkD-0001FB-27 for emacs-orgmode@gnu.org; Fri, 17 Feb 2017 09:42:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cejk8-000762-3I for emacs-orgmode@gnu.org; Fri, 17 Feb 2017 09:42:45 -0500 Received: from mail-db5eur01on0138.outbound.protection.outlook.com ([104.47.2.138]:24944 helo=EUR01-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cejk7-00073u-Ns for emacs-orgmode@gnu.org; Fri, 17 Feb 2017 09:42:40 -0500 In-Reply-To: <48db0e51591f4ff180507a99ea72ad5a@HE1PR01MB1898.eurprd01.prod.exchangelabs.com> (Roland Everaert's message of "Fri, 17 Feb 2017 12:33:39 +0000") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable 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=3D1 :var seccol=3D3 :result= s 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 =2D-=20 : Eric S Fraga (0xFFFCF67D), Emacs 26.0.50.1, Org release_9.0.4-242-g2c27b8 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQSPXCedOQfhSlwpVw3IkZPY//z2fQUCWKb15QAKCRDIkZPY//z2 fXYhAKCIJjEcDUZhcvMtnpoAEAI7ZLiUcgCfXElBIJzS6ZPKPFTWpfbZtX38L9M= =eVGG -----END PGP SIGNATURE----- --=-=-=--