Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am using grep from Gnuwin32 on Windows.

On Windows XP, the following

grep -e "foo" NUL

results in the following output

grep: NUL: invalid argument

On Windows 7, the same arguments result in no output at all.

grep just exits without any error message.

Why is the output different between Windows XP and Windows 7?

share|improve this question
    
do grep -v just to see if the versions are the same –  barlop Aug 27 '11 at 1:56
    
i'm on windows xp C:\vin>grep --v shows GNU grep 2.5.4 And I get no output when doing C:\vin>grep -e "foo" NUL –  barlop Aug 27 '11 at 1:58
add comment

1 Answer

NUL is the batch keyword for the null device (like /dev/null in linux) It is possible that in the second case, grep is correctly treating it as input, whereas in the first it is trying to access a file called 'NUL' (although this would not be the desired behavour since a file called 'NUL' cannot be created)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.