While loop help

Hi,

I wanted to change my for loop to while loop, here is my code which list trace file to a temp file and then compress those

                for TF in `cat mycompress.tmp`
            	 do
                  echo compressing ${TF}
                    gzip -f ${TF}  
                   done

can you anyone please suggest, for loop is throwing error( memory error) in AIX when number of files more

Regards,
Shaan:)

Try this:

while read line
do
       echo compressing $line
       gzip -f $line  
done < mycompress.tmp
1 Like

This should help you

12 Ways for While

Many thanks let me check

regards,
Shaan