Search code examples
linkernm

Skip address output when using GNU nm utility


Is there any ideas how to skip address output while outputting via nm?

Here is an excerpt from nm output:

0040cb94 T _fwrite
0040c8e0 t _get_ptr_from_atom
00410948 t _get_ptr_from_atom
00412fac T _GetAtomNameA@12
00412ffc T _GetCurrentProcess@0
00413004 T _GetCurrentThread@0
00412fec T _GetCurrentThreadId@0
0041305c T _GetHandleInformation@8
0040134f T _main

I want to get this output:

T _fwrite
t _get_ptr_from_atom
t _get_ptr_from_atom
T _GetAtomNameA@12
T _GetCurrentProcess@0
T _GetCurrentThread@0
T _GetCurrentThreadId@0
T _GetHandleInformation@8
T _main

How to accomplish this task using git-bash command line? I have looked for corresponding option in nm utility but seems to me there is not such option.


Solution

  • You could pipe it through awk:

    nm ... | awk '{ print $2 " " $3 }'
    

    or perhaps a regex if there are other lines of output.