1

I need to grep both stdout and stderr curl output.

When I do it the naive way I get this errror::

  $ curl -g 'localhost:9200/dt/cc/_mapping?pretty' &> | grep type
  bash: syntax error near unexpected token `|'
  $

So for now I do it this way::

  $ curl -g 'localhost:9200/dt/cc/_mapping?pretty' &> a; grep type a; rm a
            "type" : "text",
                "type" : "keyword",
            "type" : "long"
            "type" : "text",
                "type" : "keyword",
  $

What is the correct way to do that?

Sorry for the duplicate.

for >=bash-4 answer is::

$ curl -g 'localhost:9200/dt/cc/_mapping?pretty' |& grep type
     "type" : "text",
     ...
user3313834
  • 7,327
  • 12
  • 56
  • 99

0 Answers0