I want to grep nonascii characters from a lot of .gz files. However the below does not work on CentOS 7.6 (GNU grep v2.20)
$ zcat yyyy/yyyymmdd/filname.yyyymmdd.gz | grep --color='auto' -P -n "[\x80-\xFF]"$ zgrep --color='auto' -P -n "[\x80-\xFF]" yyyy/yyyymmdd/filname.yyyymmdd.gzThis perl search work
$ zcat yyyy/yyyymmdd/filname.yyyymmdd.gz | perl -ne 'print "$. $_" if m/[\x80-\xFF]/'But how do I do it on mulitple files like the following?
$ zgrep "[\x80-\xFF]" 2020/2020*/filename.2020*.gz1 Answer1
After setting LC_ALL=C, the grep -P and zgrep works now.
$ export LC_ALL=C$ zgrep --color='auto' -P -n "[\x80-\xFF]" yyyy/yyyymmdd/filname.yyyymmdd.gzYou mustlog in to answer this question.
Explore related questions
See similar questions with these tags.