0

Hi I'm trying to see if a server I'm running has been stopped (if it has, it returns a 502 Bad Gateway message.)

So I tried to do this :

curl http://MY_URL | grep "502"

The curl part returns what I expect it to.

But when I pipe it into grep, grep seems to be adding a bunch of headings :

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
113   682  113   682    0     0   230k      0 --:--:-- --:--:-- --:--:--  666k

These aren't in the output from curl. And grep on ordinary text files doesn't add them. So why are they getting added to curl piped through grep?

interstar
  • 1,281
  • 4
  • 18
  • 23

2 Answers2

2

That output is from curl. It's added when standard output is not a terminal, and in some other circumstances. Use curl -s if you don't want to see it.

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
1

It is not a grep proble, but a curl feature. Try it with cat and you will see.

You can deal around it with -s (suppress the progress meter), an -o output .

Man curl for more.

Brigo
  • 1,534
  • 11
  • 8