How to combine wget and grep
I have a html-page url and I want to grep it. How can I do it by wget someArgs | grep keyword
?
My first idea was wget -q -O - url | grep keyword
, but wget's output bypass grep and arise on the terminal in its original form.
Solution 1:
The easiest way is to use curl
with the option -s
for silent:
curl -s http://somepage.com | grep whatever
Solution 2:
Keeping this around for the sake of completeness.
Your example should actually work. The syntax is correct, and here's a screencast I just took demonstrating it, with a good old GNU wget
1.13.4.
wget -q some-url -O - | grep something
So assume your pattern is wrong and grep
will just output everything it got.