Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Grep-ing for a function name to see where it's being used returns a list of rows and row numbers. Is there a smart way of using grep and awk to get the name of the calling procedure instead?


share|improve this question
What do you mean by name of the calling procedure? – soandos Mar 22 '12 at 10:55
When you find the file with the name you are looking for and you open it, you have to scroll up to find the procedure that calls it. I am using vi so the option of an IDE isn't a choice. – Andreas Mar 22 '12 at 10:56
I mean, for example, you are looking for instances of a function called "foo()" in all files in a tree. The calling procedure/function would be the function that uses foo(), or that has foo() as part of its definition. – Andreas Mar 22 '12 at 10:57
The aim of this is after finding the line that the function call appears in, to find the context in which it's being used. – Andreas Mar 22 '12 at 11:05

For jumping to the definition of an identifier: Exuberant Ctags

For finding uses of an identifier: GNU ID-Utils (mkid indexer, lid query command)

share|improve this answer
ctags also has hotkey support in vim at least (and I'm sure other editors) to quickly jump to function definitions while coding. – mikebabcock May 30 '12 at 16:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.