gcc example.c -v 2>&1 | grep \\.a
Using the command above, I tried to redirect the output from the file descriptor 2, that is, stderr, to another file descriptor (hence >&), file descriptor 1, stdout, and used pipe to redirect the standard output to grep which will then search for lines containing the pattern .a for me (use \\ to escape the dot and search for a literal dot).