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