Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .