Wednesday, October 20, 2004

Simple For loop

Using For Loop to find a word in list of files/direcories under a directory and move it to another folder 


for file in `ls -1`; do grep "^From: Postmaster@hdfcbank.com" $file; if
[ $? -eq 0 ];then mv $file /root/work; fi; done