Here is a random idea.
get the pathname of the library(ies) then this sed expression:
sed \
 '/C [lL]ibrary /!d; s/[^0-9]*\([0-9.]*\).*/\1/' \
 /lib/libc.so.6
For me it returns either 5.4.46 or 2.2 depending on what filename is fed to it.
exp: the first regexp heavily filters the input data for the second so
significantly less cpu is spent for the real matching.
/C [lL]ibrary /!d  -- match example: "C Library "
match #1:	[^0-9]*
  match everything until we hit a digit
match #2:	\([0-9.]*\)
  match all digits and '.' and use pattern space #1
match #3:	.*
  match the remainder
We're left with pattern space #1 holding the assumed library version number.
This is done with sed version GNU 3.02.80, some versions differ, buyer beware.
$ sed '/C [lL]ibrary /!d; s/[^0-9]*\([0-9.]*\).*/\1/' /lib/libc.so.6
2.2
$ sed '/C [lL]ibrary /!d; s/[^0-9]*\([0-9.]*\).*/\1/' /lib/libc.so.5
5.4.46
$ 
-d
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/