0

i am trying to get in order the strings from the system base libraries

First the commands i use for this :

«reset» is a command for clean the screen «strings is a command for gather information from /lib64/libc.so.6 «grep» is a command for search and print coincidences «sort» is for re-arrange the order of data «sed» is for text editing without interaction «uniq» is for remove duplicate entries

well using all together :

reset ; strings /lib64/libc.so.6 | grep "^[GLIBC]" -m23 | sort -r | grep -o -P '.{0,3}GLIBC_.{0,4}' | sed 's/\.$//' | uniq -u

Output :

GLIBC_2.9
GLIBC_2.8
GLIBC_2.7
GLIBC_2.6
GLIBC_2.5
GLIBC_2.4
GLIBC_2.23
GLIBC_2.22
GLIBC_2.18
GLIBC_2.17
GLIBC_2.16 
GLIBC_2.15 
GLIBC_2.14
GLIBC_2.13 
GLIBC_2.12 
GLIBC_2.11 
GLIBC_2.10

i want the order be :

GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
GLIBC_2.9
GLIBC_2.10
GLIBC_2.11
GLIBC_2.12
GLIBC_2.13
GLIBC_2.14
GLIBC_2.15
GLIBC_2.16
GLIBC_2.17
GLIBC_2.18
GLIBC_2.22
GLIBC_2.23

or in reverse order :

GLIBC_2.23
GLIBC_2.22
GLIBC_2.18
GLIBC_2.17
GLIBC_2.16
GLIBC_2.15
GLIBC_2.14
GLIBC_2.13
GLIBC_2.12
GLIBC_2.11
GLIBC_2.10
GLIBC_2.9
GLIBC_2.8
GLIBC_2.7
GLIBC_2.6
GLIBC_2.5
GLIBC_2.4

I am under Slackware64 14.2, someone can tell me if posible re-organizate the output like i want ?

well i don't know why GLIBC_2.{19,20,21} are missing from the output xD

4
  • It sounds like you want something more like grep -E "^GLIBC_.{3,4}$" | sort -V or perhaps grep -E "^GLIBC_2\.[0-9]{1,2}$" | sort -V - note the absence of [ and ], which make it match any of the characters G,L,I,B,C Jul 30, 2021 at 1:43
  • Do you have sample output of strings | grep 'GLIBC' ? I.e. why not | grep -o '^GLIBC_[0-9.]*' | sort -uV - or perhaps ^GLIBC_[0-9][^ ]* if any version has letters.
    – ibuprofen
    Jul 30, 2021 at 2:06
  • Thanks a lot the command : reset ; strings /lib64/libc.so.6 | grep -E "^GLIBC_.{3,4}$" | sort -V | uniq is the exact i want.
    – Inukaze
    Jul 30, 2021 at 4:48
  • reset isn't necessary for this problem. Jul 30, 2021 at 8:16

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.