Lets say you have list of tar files to extract in /usr/sap/put/data file: Go to the target dir: for i in `ls /usr/sap/put/|grep -v data` do tar -xvf $i done If you want to process every single line in a file: pcheck: (params has list of parameters) for i in `cat params` do cat initBWD.ora|grep $i >> params_out for i in `cat params_out` do cat initBWD.ora|grep $i done |