Blender
Blender

Reputation: 298364

Ignoring the first line of stderr and keeping stdout intact

mongodump prints a single debug message to stderr every time it is run, which is causing some unintended side effects. How do I ignore only the first line of stderr and keep everything else intact?

I'm piping stdout to a file, so I can't combine stderr and stdout.

Upvotes: 0

Views: 198

Answers (1)

glenn jackman
glenn jackman

Reputation: 247012

Using a process substitution, and piping stdout into rev to see that stderr is unaffected

{  echo stderr1 >&2; echo stdout1; echo stderr2 >&2; } 2> >(sed 1d >&2) | rev
1tuodts
stderr2

Upvotes: 1

Related Questions