The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Special Forums > Filesystems, Disks and Memory
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 11-08-2007
Smiling Dragon's Avatar
Smiling Dragon Smiling Dragon is offline
Disorganised User
 
Join Date: Nov 2007
Location: New Zealand
Posts: 674
Quote:
Originally Posted by polive96 View Post
how can search for files that are non-zero length but are empty?
That's not really something that can happen. A non-zero file is, by definition, not empty.

To find a file that contains nothing but '0' characters. I'd try something like this
Code:
for file in <filenames>; do if egrep -v -e '^0*$' $file > /dev/null; then echo "do nothing" > /dev/null else echo "{}"; fi ; done
Reply With Quote