I'm trying to search through my codebase to find files that have an inconsistent indentation. Basically, I don't care if a file is indented with tabs or spaces, as long as it is internally consistent.
Obviously, I can run grep -Prn "^\t" src
to find lines that begin with tabs, and grep -Prn "^ " src
for spaces, but I don't know how to search for files that contain at least 1 match for both patterns.
The best I can come up with something like
for f in `grep -Prl "^\t" src` ; do grep -Pl "^ " $f; done
but that is incredibly slow for a large codebase. Is there a faster way to do this with a single grep command?