History

ver_linux: jfsutils, look for numerical input, not field number

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' + 'sed' + 'awk'.

Alexander Kapshuk committed 11 years ago

Commit 0fc8de51 parent a8782221 file · +6 −2Browse files

Showing the changes to scripts (1 of 1 file). Show all

Unified · Split

scripts/ver_linux+6−2
@@ -53,8 +53,12 @@ awk '/^tune2fs/{ · 52 unmodified lines
53 substr($0,RSTART,RLENGTH))53 substr($0,RSTART,RLENGTH))
54}'54}'
55 55
56fsck.jfs -V 2>&1 | grep version | sed 's/,//' | awk \56fsck.jfs -V 2>&1 |
57'NR==1 {print "jfsutils ", $3}'57awk '/version/{
58 match($0, /[0-9]+([.]?[0-9]+)+/)
59 printf("Jfsutils\t\t%s\n",
60 substr($0,RSTART,RLENGTH))
61}'
58 62
59reiserfsck -V 2>&1 | grep ^reiserfsck | awk \63reiserfsck -V 2>&1 | grep ^reiserfsck | awk \
60'NR==1{print "reiserfsprogs ", $2}'64'NR==1{print "reiserfsprogs ", $2}'