This line is fineAnd then after you read the man page for grep you may have tried this to grep these characters and gotten an error:
This line has  nasty character in it
This line is fine
$ grep '\240' fooWell, try this instead:
grep: Invalid back reference
$ grep $'\240' fooHope that helps.
This line has nasty character in it
P.S. Here is a way to use octal dump (od) to figure out the octal value of the nasty character you are trying to match ... in this case it's the "240":
$ grep nasty foo | od -c
0000000 T h i s l i n e h a s 240 n
0000020 a s t y c h a r a c t e r i
0000040 n i t . \n
0000046
It might be 5 years later, but this did help someone! :) The only straight forward result returned after a bit of Google-searching. Thanks Vernon.
ReplyDelete