Ygor, sorry for misleading. What I mean is, the value in file1 is unknown, or better say it changes everyday. If file1 contains 14, we need to add 5 preceding 0s to 0000014. If file1 contains 8682, we need to add 3 0s to 0008682.
My approach is to add seven 0s to the number in file1 which yields [0000000<1~7 digit number>], and cut the right hand side 7 digits to [<(7-no. of digits in file1) 0s><number in file1>].
I tried your method printf "%07d\n" `cat file1` but it doesn't work. Thanks a lot!