On Friday 15 February 2008, Meir wrote:
> I am trying to check that a file does not contain lines with terminating
> tabs (see attached). The file is about 1000 lines long in the format of
> <word><tab><tab><word><CR>, yet my "grep" finds 5 lines with terminating
> tabs. I checked the file with a binary editor - nope!
>
> all the info (input, output, version, and one "good" line for comparison)
> is included in the attached file, which also appears below.
>
> I run the same test on Ubantu and on SuSE 9.3 WITH THE SAME RESULTS (i.e.
> the same 5 lines are WRONGLY identified!)

you are not correctly passing the regex to grep.  grep is correctly 
identifying the lines based on the regex it received.

> \cygwin\bin\grep -n "[a-z]*\t\t[a-z]*\t" input.txt

you did not correctly pass the back slash to grep.  grep instead sees:
"[a-z]*tt[a-z]*t"
and considering the lines you say grep showed, sounds like grep is working 
perfectly fine.

please consult your shell documentation for how to correctly pass back slashes 
to programs (hint: you should have escaped them: \\t)
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to