March 4, 2009

Using awk for removing files

Posted in Awk at 11:54 am by alessiodini


awk is very powerful!
In this example i used it on a command for deleting some proprietary files:

ls -lrt | awk ‘{ if ($3 ~ /UE019125/) printf “rm -rf %s\n”, $9 }’ | sh

this command deletes all file of UE019125 user