ZOSOpenTools / grepport

Apache License 2.0
2 stars 0 forks source link

grep: (standard input): binary file matches #7

Open gngrossi opened 1 year ago

gngrossi commented 1 year ago

Running a CoZ command that reads JES spool and piping into grep.

bash-5.2$ fromdsn -jes.J0244354.JESMSGLG 2>/dev/null | grep DFHDB2023I | awk '{print $17}' grep: (standard input): binary file matches

Here's the data from the CoZ fromdsn command.

bash-5.2$ fromdsn -jes.J0244354.JESMSGLG 2>/dev/null | head -n5 1 J E S 2 J O B L O G -- S Y S T E M S Y S A -- N O D E H A L I N M A 1 0 23.05.32 J0244354 ---- SATURDAY, 11 MAR 2023 ----

--

fromdsn -jes.J0244354.JESMSGLG 2>/dev/null | xxd | more

00000000: 3120 2020 2020 2020 2020 2020 2020 2020 ................ 00000010: 2020 2020 4a20 4520 5320 3220 204a 204f ....J.E.S....J.O 00000020: 2042 2020 4c20 4f20 4720 202d 2d20 2053 .B..L.O.G......S 00000030: 2059 2053 2054 2045 204d 2020 5320 5920 .Y.S.T.E.M..S.Y. 00000040: 5320 4120 202d 2d20 204e 204f 2044 2045 S.A......N.O.D.E 00000050: 2020 4820 4120 4c20 4920 4e20 4d20 4120 ..H.A.L.I.N.M.A. 00000060: 3120 2020 2020 2020 200a 3020 0a20 3233 ................ 00000070: 2e30 352e 3332 204a 3032 3434 3335 3420 .......J........ 00000080: 2d2d 2d2d 2053 4154 5552 4441 592c 2020 .....SATURDAY... 00000090: 3131 204d 4152 2032 3032 3320 2d2d 2d2d ...MAR.......... 000000a0: 0a20 2020 2020 2020 2020 2020 2020 2020 ................ 000000b0: 2020 2020 2020 2020 2020 2020 2020 2020 ................ 000000c0: 2020 2020 2020 2020 2020 200a 2020 2020 ................ 000000d0: 2020 2020 2020 2020 2020 2020 2020 2020 ................ 000000e0: 2020 2020 2020 2020 2020 2020 2020 2020 ................ 000000f0: 2020 2020 2020 0a20 3233 2e30 362e 3038 ................

--

Running /bin/grep yields the proper result.

bash-5.2$ fromdsn -jes.J0244354.JESMSGLG 2>/dev/null | /bin/grep DFHDB2023I | awk '{print $17}' DGQ6

gngrossi commented 1 year ago

installed https://github.com/ZOSOpenTools/grepport/releases/download/grepport_774/grep-3.8.20230319_231207.zos.pax.Z

bash-5.2$ fromdsn -jes.J0572046.JESMSGLG 2>/dev/null | grep DFHDB2023I | awk '{print $17}' grep: (standard input): binary file matches

bash-5.2$ fromdsn -jes.J0572046.JESMSGLG 2>/dev/null | /bin/grep DFHDB2023I | awk '{print $17}' DGQ2

IgorTodorovskiIBM commented 1 year ago

What if you add the --binary-files=text option

gngrossi commented 1 year ago

that works bash-5.2$ fromdsn -jes.J0572046.JESMSGLG 2>/dev/null | grep --binary-files=text DFHDB2023I | awk '{print $17}' DGQ2

In the future, should I expect the grep port to be transparent? thanks

gngrossi commented 1 year ago

Should I close the issue? thanks

RC=(0) [SYSA] bash-5.2$ fromdsn -jes.J0781222.JESMSGLG 2>/dev/null | grep --binary-files=text DFHDB2023I | awk '{print $17}' DGQ1

RC=(0) [SYSA] bash-5.2$ fromdsn -jes.J0781222.JESMSGLG 2>/dev/null | grep DFHDB2023I | awk '{print $17}' grep: (standard input): binary file matches

RC=(0) [SYSA] bash-5.2$ fromdsn -jes.J0781222.JESMSGLG 2>/dev/null | /bin/grep DFHDB2023I | awk '{print $17}' DGQ1

gngrossi commented 3 months ago

Is this working as expected? If so, I will close. thanks