2

I'm trying to grep some curl content however I'm still getting curl output even though I'm piping it via grep.

E.g.

curl -svo /dev/null <some url>   | grep <some text>

Any idea what I'm doing wrong?

  • you mean you're getting output that's not matching the grep? Are they long lines that match somewhere unexpectedly? – Jeff Schaller Mar 13 '17 at 16:18
  • You're aware that options -s and -v have more or less opposite effects, right? – Satō Katsura Mar 13 '17 at 16:22
  • They're misleading but not opposite. -v outputs additional curl output. -s prevents the progress bar header. – Snowcrash Mar 14 '17 at 9:55
2

You pipe only the stdout to grep, but your curl puts out errors to stderr which are printed without passing the grep. If you want the stderr to be filtered, too, redirect it to stdout first.

  • Hardly need to take a wild guess. It's pretty obvious how to fill in the blanks. Here's an example if you're struggling: curl -svo /dev/null https://www.google.com | grep google – Snowcrash Mar 13 '17 at 16:28
  • @SnowCrash Thank you. I didn't try. Removed the wild guess from my answer, as I obviously guess right. – Philippos Mar 13 '17 at 16:33
  • @SnowCrash If your question is solved, please close it by marking it as answered – Philippos Mar 14 '17 at 7:13

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.