Advertisement
image28

Get Project Include Files

Jul 18th, 2019
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.35 KB | None | 0 0
  1. # Get all unique includes from the project in the current directory
  2. function project-includes()
  3. {
  4.     IFS=$'\n';
  5.     CURDIR=`pwd`;
  6.     for e in `find $CURDIR -name "*.c" -print`;
  7.     do
  8.         grep -iEo "#[ ]{0,}include [\<\"][A-Za-z0-9\.\-\\/\\\]{1,}\.h[\>\"]" $e;
  9.     done | tr -d ' ' | sort | uniq | grep -v "\"" | grep -iEo "[\<].*[\>]" | tr -d '<' | tr -d '>'
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement