0

I want to exclude some erros from log. I'm using a Raspberry 3b+.

I use

main.py >> log.txt 2>&1 | grep -v "Network is unreachable"

My error that I don't want is

[tcp @ 0x19ccea0] Connection to tcp://192.168.1.32:554?timeout=0 failed: Network is unreachable

I can put the whole error in grep because the ip adress may change

However this error is still in my log.txt file when I run my main.py

1 Answer 1

1

You need to pipe to grep, and then redirect grep's output to the file. You're redirecting all the output to the file, so nothing goes to grep.

main.py 2>&1 | grep -v "Network is unreachable" >> log.txt
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.