I am encountering an issue with a file that has been downloaded from zOS to our Linux system in binary mode. The file is encoded in EBCDIC and contains characters such as ‘xf1xf2’. To check whether the file includes the binary sequence “xf1”, I have been using the following grep command: grep -obUaP “xf1” file
However, despite the presence of “xf1” in the file, the command does not return any results. Interestingly, the command works correctly for “x01”.
We need to keep the file in its original EBCDIC encoding and do not wish to use any transcoding tools like iconv to convert it to ASCII or UTF-8. Could you please advise on how to modify the grep command or suggest an alternative approach to successfully locate the “xf1” binary sequence within the file while keeping the file unchanged?
Cai Cai is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
have you tried using od (octal dump)
?
https://man7.org/linux/man-pages/man1/od.1.html
1