Real life example: I needed to identify all the zipfiles in a directory tree and delete all *.exe files hiding inside the zipfiles.
First collect the files:
This shows all the zipfiles that were in subdirectories of subdirectories, then sorts them for size so I can decide to leave out the small ones. xcol is a perl script I posted to Code section to extract the column of filenames to file oldfiles.du -b */*/old.zip | sort -n | xcol 1 >oldfiles
Then use this perl one-liner:
perl -e 'while (<>) { chop; system qq{zip -d "$_" "*exe*"} }' oldfiles
Love that Perl!
HTH,
SSF
In reply to multiple file operations using perl one-liners by sflitman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |