This is the first time I'm using Cygwin and I have not so much experience with scripts.

I'm trying to grep words out of a XML document and need to get them counted. When I press enter I get a message that grep: foo.xml: No such file or directory.

emmy@KRIM-PC ~ 
$ grep "original\-recipient\-address>049." foo.xml |wc -l 
grep: foo.xml: No such file or directory 

I've been googling and reading for hours and I can't understand what's wrong?! The file exists and it's located in C:\Users\emmy\Downloads.

  • the directory you were in clearly does not have the file in question. Navigate to that directory from within Cygwin and it will work. – Ramhound Sep 5 '14 at 11:40
  • Without cygwin here grep from UnxUpdates.zip – crazypotato Sep 5 '14 at 11:52

You write the file is in C:\Users\emmy\Downloads. The Cygwin command prompt shows

emmy@KRIM-PC ~ 

the ~ is actually your working directory. It means your home directory (probably /home/emmy/). Try cd cd /cygdrive/c/Users/emmy/Downloads and then run your grep command again.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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