bash - grep and sed - find function calls in files -


i need find usages of class methods in project folder (for refactoring).

now i'm search grep -nr "classname." .. , list like:

file1.js:874:    var x = classname.method1() + m; file5.js:330:    console.log(classname.method2()); etc... 

my goal methods used in files without code around.

for example if have line in file like:

if(classname.varissetted()) 

in output only:

varissetted 

also want remove duplicates , sort lines, it's not problem sort , uniq @ end of pipe.

you try below grep command.

grep -opr '\bclassname\.\k\w+(?=\()' 

\k discards matched chars printing @ final.


Comments