bug-gawk
[Top][All Lists]
Advanced

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

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


From: Andrew J. Schorr
Subject: Re: [bug-gawk] Match field one and print field three
Date: Wed, 15 May 2019 12:47:32 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

Although /^libasan\.so\./  would work just as well...

On Wed, May 15, 2019 at 10:34:31AM -0600, address@hidden wrote:
> Hi.
> 
> You need to write it this way:
> 
>      $ ldd lib/.libs/libidn.so | awk '$1 ~ /^libasan\.so\..*/ {print $3}'
> 
> The == is a string comparison, meaning an exact comparison; the ~ does
> a regular expression match.
> 
> HTH,
> 
> Arnold
> 
> Jeffrey Walton <address@hidden> wrote:
> 
> > 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)

-- 
Andrew Schorr                      e-mail: address@hidden
Telemetry Investments, L.L.C.      phone:  917-305-1748
545 Fifth Ave, Suite 1108          fax:    212-425-5550
New York, NY 10017-3630



reply via email to

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