Messages in this thread Patch in this message | | | From | Alexander Kapshuk <> | Date | Thu, 1 Oct 2015 21:36:47 +0300 | Subject | [PATCH] ver_linux: jfsutils.patch |
| |
Not to be critical of anyone, I believe that using 'grep' along with 'sed', and 'awk' in this kind of context as a one-off quick solution to be run on the command line may very well be justified. However, in a script, 'awk' or 'sed' are more than capable of doing most of the things we may be looking to achieve by using a combination of 'grep', 'sed', and 'awk'.
The proposed implementation relies on 'sed' to perform all the text processing required.
Tested on: Arch Linux
Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com> ---
--- linux/scripts/ver_linux.orig 2015-08-30 21:34:09.000000000 +0300 +++ linux/scripts/ver_linux 2015-09-30 22:42:39.748757706 +0300 @@ -30,8 +30,14 @@ tune2fs 2>&1 | grep "^tune2fs" | sed 's/,//' | awk \ 'NR==1 {print "e2fsprogs ", $2}'
-fsck.jfs -V 2>&1 | grep version | sed 's/,//' | awk \ -'NR==1 {print "jfsutils ", $3}' +fsck.jfs -V 2>&1 | +sed ' + /version/!d + s/.*version[ \t]// + s/[ \t].*// + s/[^0-9]$// + s/^/jfsutils\t/ +'
reiserfsck -V 2>&1 | grep ^reiserfsck | awk \ 'NR==1{print "reiserfsprogs ", $2}'
| |