0

I'm trying to run the following command in windows. I've managed to install cURL, but Grep still fails to identify as a command.

curl -k --silent "http://192.168.1.135:88/cgi-bin/CGIProxy.fcgi?cmd=getDevState&usr=USERNAME&pwd=PASSWORD" | grep -oP "(?<=motionDetectAlarm>).*?(?=</motionDetectAlarm>)"

Is there an alternative command or a way to install Grep onto Windows?

Update I've installed Grep and added the following to my Path variables, both system and user, and restarted to no avail. C:\Program Files (x86)\GnuWin32

  • Have you installed grep? If so, make sure it is in your path. If you haven't installed it then go to Grep for Windows – DavidPostill Mar 21 '18 at 16:28
  • I used the installer from the site and left it to the default location (Program Files (x86)). Should I install in to the path (Windows/System32)? – Luke Hartman Mar 21 '18 at 16:33
  • Add the location to your path. See What are PATH and other environment variables, and how can I set or use them? – DavidPostill Mar 21 '18 at 16:41
  • I've done so yet I still receive the same error. – Luke Hartman Mar 21 '18 at 17:00
  • 1
    run echo %PATH% and do dir grep.exe /s/b by the way, the file should probably be in gnuwin32\bin not in just gnuwin32. And gnuwin32\bin should be in the path – barlop Mar 21 '18 at 17:47
0

I've installed Grep and added the following to my Path variables, both system and user, and restarted to no avail.

A couple things to remember:

  • As @barlop comments, the path should be e.g. C:\Program Files (x86)\GnuWin32\bin.

  • It is perfectly fine to specify the whole path to grep e.g.:

    curl -k --silent "http://192.168.1.135:88/cgi-bin/CGIProxy.fcgi?cmd=getDevState&usr=USERNAME&pwd=PASSWORD" | "C:\Program Files (x86)\GnuWin32\bin\grep.exe" -oP "(?<=motionDetectAlarm>).*?(?=</motionDetectAlarm>)"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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