The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 10-10-2008
vivek.gkp vivek.gkp is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 11
Post printing and deleting using awk

I am trying to print and delete at the same time 0KB files... using following command

a-> find . -type f | xargs ls -l | awk '{ if($5 == 0) {print $0;}}' | xargs rm $0

but am not successful. Can somebody tell me how to do this ... same time I need files to be printed as well deleted later.

I used tee command as well like this

b-> ListFilesZKB | tee | xargs rm $0

where ListFilesZKB is shell script for (a) excluding last pipe.