kodeninja
kodeninja

Reputation: 349

tail pipe grep pipe xmllint not working

I'm trying to get the below command working but no o/p is getting printed:

tail -f mylog.log | grep --line-buffered -Eo '<S:Envelope .+Envelope>' | xmllint --format --recover -

However, if I grep the same pattern from a file, and pipe it to xmllint, it works:

grep --line-buffered -Eo '<S:Envelope .+Envelope>' tmp.xml | xmllint --format --recover -

What am I missing in the first command?

Upvotes: 1

Views: 2634

Answers (2)

jaypal singh
jaypal singh

Reputation: 77185

Try something like this -

grep --line-buffered -Eo '<S:Envelope .+Envelope>' <(tail -f mylog.log) &1> xmllint --format --recover -

Upvotes: 0

fge
fge

Reputation: 121830

Can you try this (untested):

tail -f mylog.log | grep -Eo '<S:Envelope .+Envelope>' | while read line; do
    echo $line | xmllint --format --recover -
done

(that is under the hypothesis that xmllint does not find EOF and as such is still waiting for input)

Upvotes: 6

Related Questions