Sample Header Ad - 728x90

Programs to visually verify the placement of null bytes by grep

3 votes
2 answers
303 views
I have been using the grep command with --null. grep --null -r -n -- "$pstr" "$pdir" The man page for my version of grep (on Mac OS Sequoia) says: > --null Prints a zero-byte after the file name. To identify exactly where the NULL byte (\0) is introduced in the output of a grep command (especially with --null), I need to run some tools that can display non-printing and control characters in a visible or unambiguous way. What specific program can I use to identify and thus verify exactly where the NULL byte \0 is being introduced by grep without having to blindly rely upon the description in the grep documentation. All I can see is that without --null, the command gives something like: ./opcon.rc:1392:## For GLOB, the IF clause requires the Test Operator == ./opcon.rc:1393:## For REGX, the IF clause requires the Test Operator =~ ./opcon.rc:1401:## The Case Condition clause requires Shell Glob Patterns With --null, it looks like: ./opcon.rc1392:## For GLOB, the IF clause requires the Test Operator == ./opcon.rc1393:## For REGX, the IF clause requires the Test Operator =~ ./opcon.rc1401:## The Case Condition clause requires Shell Glob Patterns It got rid of the :, but it's not obvious what else it did.
Asked by Filangieri (179 rep)
Jun 9, 2025, 09:02 PM
Last activity: Jun 10, 2025, 10:08 PM