I have to create a huge file of 85 entries in the following format:user_dept1=$( while read -r x && read -r y <&3; do   echo  model: $model_1  user: $x department: $y License_Used: $p_out1; done < /home/user_files/out1.txt 3</home/dept_files/dep1.txt | ts '%Y-%m-%d %H:%M:%S')user_dept2=$( while read -r x && read -r y <&3; do   echo  model: $model_2  user: $x department: $y License_Used: $p_out2; done < /home/user_files/out2.txt 3</home/dept_files/dep2.txt | ts '%Y-%m-%d %H:%M:%S')and so on till user_dept85user_dept85=$( while read -r x && read -r y <&3; do   echo  model: $model_85  user: $x department: $y License_Used: $p_out85; done < /home/user_files/out85.txt 3</home/dept_files/dep85.txt | ts '%Y-%m-%d %H:%M:%S')Hence the strings below will be renamed every time from 1-85:user_dep1 - user_dept85$model_1 -  $model_85$p_out1  - $p_out85out1.txt - out85.txtdep1.txt - dep85.txt
echo same string 85 times with some ascending numbers within it
bash;shell script;sed;seq
You just want to generate 85 lines of code?for a in {1..85}do  echo user_dept$a=\$( while read -r x && read -r y <&3; do   echo \ model: \$model_$a  user: \$x department: \$y License_Used: \$p_out$a\; done < /home/user_files/out$a.txt 3</home/dept_files/dep$a.txt | ts '%Y-%m-%d %H:%M:%S')done > resulting_codeThe trick is to make sure that quoting is observed.  So the $ and  characters need to be quoted as \$ and \The first 3 lines of the resulting output:user_dept1=$( while read -r x && read -r y <&3; do   echo  model: $model_1  user: $x department: $y License_Used: $p_out1; done < /home/user_files/out1.txt 3</home/dept_files/dep1.txt | ts '%Y-%m-%d %H:%M:%S')user_dept2=$( while read -r x && read -r y <&3; do   echo  model: $model_2  user: $x department: $y License_Used: $p_out2; done < /home/user_files/out2.txt 3</home/dept_files/dep2.txt | ts '%Y-%m-%d %H:%M:%S')user_dept3=$( while read -r x && read -r y <&3; do   echo  model: $model_3  user: $x department: $y License_Used: $p_out3; done < /home/user_files/out3.txt 3</home/dept_files/dep3.txt | ts '%Y-%m-%d %H:%M:%S')