4

Grep Regular Expression Puzzle (files containing only \0 characters)

view full story
linux-howto

http://www.linuxforums.org – This one is a puzzle... Need to search a filesystem that contains select files (randomly distributed) where an impacted file got each byte of its data nulled out \0. So the impacted files still have the same filesize, but the file no longer works (null bytes). Grep seems a great way to identify which files were impacted. Among the dozen or so variations I've tried, \0+[^\0]* was my best shot. Unfortunately, that found files containing valid data after nulls anywhere in the file. Could you suggest a grep regular expression that would identify all and only those files where all bytes of its data have been nulled \0? Thanks and Best Wishes, Bob (HowTos)