0

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.gz

This 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*.gz
askedSep 13, 2020 at 14:28
fivelements's user avatar

1 Answer1

0

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.gz
answeredSep 13, 2020 at 14:45
fivelements's user avatar

You mustlog in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.