I' m trying to use the Gnuwin32 grep command to produce a list of files I would like to feed to another command (a Perl script really). I have a bunch of HTML files and I wish to list every one of them that matches the regexp itemprop=['"]description
.
Now, after some fiddling, I've found that the cmd.exe invocation
grep -i -E -l "itemprop=['\"]description" path/to/files/*.htm
works fine, but I can't pipe its output to perl (or any other command, for that matter):
grep -i -E -l "itemprop=['\"]description" path/to/files/*.htm | perl myscript.pl
prints a list of files to terminal, followed by
grep: |: No such file or directory
grep: perl: No such file or directory
myscript.pl
grep treats | and subsequent words as arguments. How do I avoid that?
Furthermore, I tried to overcome the issue with Powershell. I can pipe just fine from there (if I use an elementary expression, like "itemprop"), but I have trouble specifying the expression to search for.
grep -i -E -l "itemprop=['\"]description" path/to/files/*.htm
just doesn't work. Powershell shows me a >> sign I don't even know what it means (expecting more input)? I've tried every manner of escaping quotes but none seems to work. Sometimes it's the shell, sometimes it's grep that's complaining for an unmatched [ character.
Any help is greatly appreciated.