0

There is a shared library say, libsample.so & libsample.so.abc.xy (a,b,c,x and y are 0-9), former having soft link to latter.

How to extract "abc.xy" field from SONAME section of libsample.so?

I have tried below command : $ objdump -p libsample.so | grep SONAME | awk {' print $2'} this prints : libsample.so.abc.xy

But how to further fetch "abc.xy"?

psy
  • 181
  • 1
  • 8

1 Answers1

1

sed

sed 's/.*\.so.//'

Test:

kent$  sed 's/.*\.so.//' <<<"foo.so.bar.so.so.we.want.this"
we.want.this

awk

 awk -F'so[.]' '{print $NF}'

Test:

kent$  awk -F'so[.]' '{print $NF}' <<<"foo.so.bar.so.so.we.want.this"
we.want.this
Kent
  • 189,393
  • 32
  • 233
  • 301