Pages

Sunday, April 6, 2014

Write a shell script that removes files that contain a string

$ find . | xargs grep -l "FOOBAR" | awk '{print "rm -f "$1}' > doit.sh

After this command you can review doit.sh file before executing it.


If it looks good, execute: `. doit.sh`




commandlinefu.com


by David Winterbottom (codeinthehole.com)






from All commands http://ift.tt/1jRn12q

No comments:

Post a Comment