Bash script for extracting function calls from c files

我与影子孤独终老i 提交于 2019-12-11 09:44:33

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!