grep is not recognized as an internal or external in windows
Solution 1
You can install all these nice UNIX commands with Cygwin (https://www.cygwin.com/).
Solution 2
CMD
does not have grep
like unix does. This applies to many commands, such as sed
, awk
, sudo
, cat
...etc.
However, if you use PowerShell instead of cmd, it has a Select-String
cmdlet which will allow you to get similar results.
scholar.py --txt-globals --author "albert einstein" | Select-String '[G]' | Select-String 'Results'
I haven't tested the Regex. But if Select-String
isn't giving you the required results you can install Grep for Windows.
Solution 3
Use findstr
instead grep
, because cmd doesn't cover grep
syntax as it works on Linux.
Related videos on Youtube
user3136171
Updated on September 18, 2022Comments
-
user3136171 over 1 year
I am trying to run this line
scholar.py --txt-globals --author "albert einstein" | grep '\[G\]' | grep Results
In the CMD, but I confront this error. I know
grep
is for UNIX but how can I run this line in windows? I have windows 7. -
user3136171 over 7 yearsI install grep for windows and add its path to environment variable of windows. this error is gone but there is another one.
-
Admin about 2 yearsThanks, this worked for me