I'm trying to remove "Packet number 624 doesn't match" from a response so the obvious thing to try is
cat somefile.txt | grep -v "Packet number \d+ doesn't match"
If I remove the -v
, just for testing, then it returns nothing. So maybe the command line is doing something with the \d
or +
first. So I have tried various combinations such as \\d+ \\d\+ \\\\d+ \\\\d\+ [0-9]+ [0-9]\+
. Bingo!! That last one worked. Can someone explain what is going on here? If this is getting modified by the command line why does echo "\d+"
still return \d+
?