Sunday, November 11, 2007

for i ... do ... done bash shell script

This the most usefull shell script I have come across for most of my day to day work on unix:
the oneliner.txt is an ascii file with one entry per line.
I usually modify this file with a vim search-an-replace like:
:%s/^.*\///gc


for i in `cat oneliner.txt`
do grep $i *.map.xml > /dev/null
if [ $? -eq 1 ]
then
echo $i
fi
done

No comments: