[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-gawk] Match field one and print field three

From: Jeffrey Walton
Subject: [bug-gawk] Match field one and print field three
Date: Tue, 14 May 2019 21:43:35 -0400

Hi Everyone,

I'm having trouble testing a library. To test the library I need to
LD_PRELOAD another another library. The rub is, the library is paired
with the compiler, so I have to wait for the artifact to be built and
then have ldd tell me which library to use.

The awk below needs to find libasan.so.* in field one, then then print
field three:

$ ldd lib/.libs/libidn.so
        linux-vdso.so.1 (0x00007ffd1bd9e000)
        libasan.so.5 => /lib64/libasan.so.5 (0x00007ff41339c000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007ff413396000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007ff413374000)
        libc.so.6 => /lib64/libc.so.6 (0x00007ff4131ae000)
        librt.so.1 => /lib64/librt.so.1 (0x00007ff4131a4000)
        libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007ff41300c000)
        libm.so.6 => /lib64/libm.so.6 (0x00007ff412e86000)
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007ff412e6b000)
        /lib64/ld-linux-x86-64.so.2 (0x00007ff4141c6000)

However, the result of the awk is empty so I am doing something wrong:

    $ ldd lib/.libs/libidn.so | awk '$1 == "libasan.so.*" {print $3}'

How do I fix the awk?

In case it is needed:

$ awk --version
GNU Awk 4.2.1, API: 2.0 (GNU MPFR 3.1.6-p2, GNU MP 6.1.2)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]