This is not really working. Probably try a slightly different approach.
Likely using some library would work better, or if the commandline had an actual ast-tree output.
But the approach now will be grep \#include file.h and grep -v \#include file.h |clang -cc1 -ast-print