I'm running a psql query like so:
$ psql --file=foo.sql "BAR-DB"
Where foo.sql contains the query. foo.sql has bad syntax, so the output is a list of error messages. My plan was to pipe the output to grep so I can filter specific error messages, but
$ psql --file=foo.sql "BAR-DB" | grep PATTERN
doesn't seem to do anything. psql's documentation shows the optional flag:
-o, --output=FILENAME send query results to file (or |pipe)
but I'm not sure how to use it to pipe the output to grep. What is the proper syntax?