sudo dmidecode | grep State 2> /dev/null
Boot-up State: Safe
Power Supply State: Safe
Thermal State: Safe
Invalid entry length (16). Fixed up to 11
I don't want the Invalid entry error in the output. How do I filter that?
As Wildcard commented, you've mistakenly redirected grep's stderr instead of sudo/dmidecode's. Use this instead:
sudo dmidecode 2>/dev/null | grep State
grep's standard error, but notdmidecode's.