问题
I'm new to scripting, and I'm attempting to extract all function calls from a c files, all present in a directory. Here is my code so far, but it seems to be giving no output.
#!/bin/bash
awk '/[ \t]*[a-zA-Z_]*\(([a-zA-Z_]*[ \t]*,?)*\);/ {print $0}' *.c
I'm stumped. Also the c files all have at least one function call.
回答1:
You should debug your regexp. Reduce it until you get some matches, then add again the other parts, checking if you get the expected results.
来源:https://stackoverflow.com/questions/17398732/bash-script-for-extracting-function-calls-from-c-files