public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexander Kapshuk <alexander.kapshuk@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: gregkh@linuxfoundation.org, jim.epost@gmail.com, richard@nod.at,
	tytso@mit.edu, Alexander Kapshuk <alexander.kapshuk@gmail.com>
Subject: [PATCH 09/22] ver_linux: xfsprogs, look for numerical input, not field number
Date: Mon, 12 Oct 2015 21:39:49 +0300	[thread overview]
Message-ID: <1444675202-1375-9-git-send-email-alexander.kapshuk@gmail.com> (raw)
In-Reply-To: <1444675202-1375-1-git-send-email-alexander.kapshuk@gmail.com>

Rely on regex to find the version number, rather than rely on numerical input to be found in a particular input field.
Proposed implementation also eliminates the necessity to invoke 'grep' + 'awk'.

Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
---
 scripts/ver_linux | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/scripts/ver_linux b/scripts/ver_linux
index 65d4c02..a926225 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -70,8 +70,12 @@ awk '/^reiserfsck/{
 fsck.reiser4 -V 2>&1 | grep ^fsck.reiser4 | awk \
 'NR==1{print "reiser4progs          ", $2}'
 
-xfs_db -V 2>&1 | grep version | awk \
-'NR==1{print "xfsprogs              ", $3}'
+xfs_db -V 2>&1 |
+awk '/version/{
+	match($0, /[0-9]+([.]?[0-9]+)+/)
+	printf("Xfsprogs\t\t%s\n",
+	substr($0,RSTART,RLENGTH))
+}'
 
 pccardctl -V 2>&1| grep pcmciautils | awk '{print "pcmciautils           ", $2}'
 
-- 
2.4.9


  parent reply	other threads:[~2015-10-12 18:46 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-12 18:39 [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 02/22] ver_linux: make --version, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 03/22] ver_linux: binutils, fix inaccurate output Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 04/22] ver_linux: util-linux, 'fdformat' not ubiquitous any longer Alexander Kapshuk
2015-10-12 22:04   ` Jim Davis
2015-10-12 18:39 ` [PATCH 05/22] ver_linux: module-init-tools, look for numerical input, not field number Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 06/22] ver_linux: e2fsprogs, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 07/22] ver_linux: jfsutils, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 08/22] ver_linux: reiserfsprogs, " Alexander Kapshuk
2015-10-12 18:39 ` Alexander Kapshuk [this message]
2015-10-12 18:39 ` [PATCH 10/22] ver_linux: pcmciautils, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 11/22] ver_linux: quota-tools, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 12/22] ver_linux: ppp, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 13/22] ver_linux: libc, input redirection to sed fails in some distros Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 14/22] ver_linux: ldd, look for numerical input, not field number Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 15/22] ver_linux: libcpp, fix missing output Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 16/22] ver_linux: procps, look for numerical input, not field number Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 17/22] ver_linux: net-tools, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 18/22] ver_linux: loadkeys, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 19/22] ver_linux: sh-utils, " Alexander Kapshuk
2015-10-12 18:40 ` [PATCH 20/22] ver_linux: use 'udevadm', instead of 'udevinfo' Alexander Kapshuk
2015-10-12 18:40 ` [PATCH 21/22] ver_linux: wireless-tools, look for numerical input, not field number Alexander Kapshuk
2015-10-12 18:40 ` [PATCH 22/22] ver_linux: proc/modules, limit text processing to 'sed' Alexander Kapshuk
2015-10-12 20:22   ` Jim Davis
2015-10-13 17:33     ` Alexander Kapshuk
2015-10-13 23:21 ` [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number Jim Davis
2015-10-14  9:29   ` Alexander Kapshuk
2015-10-14 21:43     ` Jim Davis
2015-12-02 14:24 ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1444675202-1375-9-git-send-email-alexander.kapshuk@gmail.com \
    --to=alexander.kapshuk@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jim.epost@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=richard@nod.at \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox