I have a file which contains Inverted exclamation mark, I want to count number of occurrences of these inverted exclamation marks using Linux grep command.
I have tried hex representation of this character as follows. but it is returning complete file , not exactly the lines which are matching this text.
grep -v "["$'\xA1'"]" K2345061.005
Thanks in advance for sharing any idea on this issue.
grep -v
is used to list files which do not match. Remove the -v
option.
If your grep supports the -P
flag for PCRE regex syntax, you can use that:
$ echo -e '\xa1Ay caramba!' > /tmp/a1.dat
$ grep -P '\xa1' /tmp/a1.dat
¡Ay caramba!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.