Grep + Awk

another tips for unix file management :

how to use grep an awk combined ? here is a simple example : i want to delete those boring ._* files created by macosx that i scp to my server

make a test :
find myDirectory/ "\._*" | grep "\._" | awk '{print "rm "$1}' > tmp_file

if cat tmp_file looks good, then execute the code !
find myDirectory/ "\._*" | grep "\._" | awk '{print "rm "$1}' | sh

there is probably better but i just know this tips :)

Tags: sysadmin, tips, ubuntu

Related posts