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'.
Showing the changes to scripts (1 of 1 file). Show all
Unified · Split
| @@ -70,8 +70,12 @@ awk '/^reiserfsck/{ · 69 unmodified lines | ||
| 70 | 70 | fsck.reiser4 -V 2>&1 | grep ^fsck.reiser4 | awk \ |
| 71 | 71 | 'NR==1{print "reiser4progs ", $2}' |
| 72 | 72 | |
| 73 | −xfs_db -V 2>&1 | grep version | awk \ | |
| 74 | −'NR==1{print "xfsprogs ", $3}' | |
| 73 | +xfs_db -V 2>&1 | | |
| 74 | +awk '/version/{ | |
| 75 | + match($0, /[0-9]+([.]?[0-9]+)+/) | |
| 76 | + printf("Xfsprogs\t\t%s\n", | |
| 77 | + substr($0,RSTART,RLENGTH)) | |
| 78 | +}' | |
| 75 | 79 | |
| 76 | 80 | pccardctl -V 2>&1| grep pcmciautils | awk '{print "pcmciautils ", $2}' |
| 77 | 81 | |