How to recursively search and destroy tabs

Inspite of my best efforts, eclipse 3.5 seems to continue to misbehave and insert tab characters in my source code.

How do I write a script execute from emacs to search all my files for tab characters and conveniently position me on the line of code that has the offending tab?

Here are my attempts that match lines with no tabs!

find . \( -name \.xml -o -name \.java \) | xargs grep -inr "\t"
find . \( -name \.xml -o -name \.java \) | xargs grep -inr "\\t"

What am I doing wrong? I'm using RHEL 3. Yeah -- I know it is ancient but it is not my choice of OS! (I would prefer something a little more modern!).

Siegfried

I think the \t character is not defined in grep. Instead I think you could just type tab character in quotes. If your shell performs file name completion you can use CTRL-V [TAB].

find . \( -name \*.xml -o -name \*.java \) | xargs grep -n '   '

You do not need the -i and the -r options.

Hi.

\t works fine with grep (in single or double quotes). It just doesn't like the -i option.

But why would you search for a case-insensitive tab?

Hi scottn,

I just tried and my grep (GNU grep 2.5.3) does not understand \t, it works fine with ctrl-v TAB however. With "\t" or '\t' it lists all the lines that contain the letter 't' .

Hm. I have GNU 2.5.1 and it works just fine. (Redhat 4.1).

That's progress!

FWIW I could not find a mentioning of escape sequences in the 2.5.3 grep man/info pages, whereas it is mentioned the awk and sed pages. Is it in your grep 2.5.1 man/info page?

Hi.

Like you, there's nothing in the grep man page, but awk says

exactly, it is mentioned in the awk and sed man pages but not in man grep.