I’m grappling with an issue for the last few weeks. I’m unable to explain why I don’t get the logs in the third process when I pipe the logs from docker. For eg.
$ echo "hello world!" | egrep -ai "hello" | sed -e 's/hello/Hello/'
Hello world!
As you notice, sed
gets the line and can run the script.
sed
in the following command doesn’t receive the input.
# grep returns matching lines
$ docker-logs 87b7826c2828 |& egrep -ai "EventLogger"
2024-09-19 16:52:57,646 INFO [EventLogger]: xxxxxx
# It appears that sed is not getting any input
$ docker-logs 87b7826c2828 |& egrep -ai "EventLogger" | sed -s "s/EventLogger/Transform/"
# No output
I wonder why the output of egrep is not connected to the input of sed
. I replaced |&
with 2>&1 |
as I noticed the same behavior on OSX with zsh and on Linux with bash. Am I missing something here?