[X-Unix] finding duplicate files

Eric F Crist ecrist at secure-computing.net
Wed Jun 20 12:35:59 PDT 2007


On Jun 20, 2007, at 2:19 PMJun 20, 2007, Dave Higgins wrote:

>
> On Jun 20, 2007, at 1:54 PM, Eric F Crist wrote:
>
>> Sorry to reply to myself, but I'm wrong!  the line should be:
>>
>> perl -e 'foreach $file ( `find . | grep -v .gz` ) { chomp ( $file  
>> = $file ) ; if ( !-e "$file.gz" ) { print "gzipping file: $file;  
>> gzip $file; } }'
>
> Love these little one-liners... But, I'm drawing errors when  
> testing this...
>
> in sh: Can't find string terminator '"' anywhere before EOF at -e  
> line 1.
>
> in tcsh: -e: Event not found.
>
> The first one, in reply to the OP, works great, though. :-)
>
> Dave.
>

I promise I'll test it before I post next time.  Here's the working  
line, minus my two typos:

perl -e 'foreach $file (`file . | grep -v .gz`) { chomp($file); if (!  
-e "$file.gz") { print "gzipping file: $file" `gzip $file`; }}'

Thanks for playing!
-----
Eric F Crist
Secure Computing Networks




More information about the X-Unix mailing list