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
| @@ -87,8 +87,12 @@ awk '/pcmciautils/{ · 86 unmodified lines | ||
| 87 | 87 | cardmgr -V 2>&1| grep version | awk \ |
| 88 | 88 | 'NR==1{print "pcmcia-cs ", $3}' |
| 89 | 89 | |
| 90 | −quota -V 2>&1 | grep version | awk \ | |
| 91 | −'NR==1{print "quota-tools ", $NF}' | |
| 90 | +quota -V 2>&1 | | |
| 91 | +awk '/version/{ | |
| 92 | + match($0, /[0-9]+([.]?[0-9]+)+/) | |
| 93 | + printf("Quota-tools\t\t%s\n", | |
| 94 | + substr($0,RSTART,RLENGTH)) | |
| 95 | +}' | |
| 92 | 96 | |
| 93 | 97 | pppd --version 2>&1| grep version | awk \ |
| 94 | 98 | 'NR==1{print "PPP ", $3}' |