title: Reading multiple lines using read line do
body: <p>OK i'm an absolute noob to this (only started trying to code a few weeks ago for my job) so please go easy on me
  IM on an aix system
  I have file1, file2 and file3 and they all contain 1 column of data (text or numerical).</p>
  
  <pre><code>file1
  VBDSBQ_KFGP_SAPECC_PRGX_ACCNT_WKLY
  VBDSBQ_KFGP_SAPECC_PRGX_ADDRM_WKLY
  VBDSBQ_KFGP_SAPECC_PRGX_COND_WKLY
  VBDSBQ_KFGP_SAPECC_PRGX_CUSTM_WKLY
  VBDSBQ_KFGP_SAPECC_PRGX_EPOS_DLY
  VBDSBQ_KFGP_SAPECC_PRGX_INVV_WKLY
  
  file2
  MCMILS03
  HGAHJK05
  KARNEK93
  MORROT32
  LAWFOK12
  LEMORK82
  
  
  file3
  8970597895
  0923875
  89760684
  37960473
  526238495
  146407
  </code></pre>
  
  <p>There will be the exact same amount of lines in each of these files.
  I have another file called "dummy_file" which is what i want to pull out, replace parts and pop into a new file. </p>
  
  <pre><code>WORKSTATION#JOB_NAME
  SCRIPTNAME "^TWSSCRIPTS^SCRIPT"
  STREAMLOGON "^TWSUSER^"
  -job JOB_NAME -user USER_ID -i JOB_ID
  RECOVERY STOP
  </code></pre>
  
  <p>There are only 3 strings i care about in this file that i want replaced and they will always be the same for the dummy files i use in future</p>
  
  <pre><code>JOB_NAME
  JOB_ID
  USER_ID
  </code></pre>
  
  <p>There are 2 entries for JOB_NAME and only 1 for the others. What i want is take the raw file, replace both JOB_NAME entries with line 1 from file1 then replace USER_ID with line 1 from file 2 and then replace JOB_ID with line 1 from file3 then throw this into a new file
  I want to repeat the process for all the lines in file 1, 2 and 3 so the next one will have its entries replaced by line 2 from the 3 files then next one will have its entries replaced by line 3 from the 3 files then all of line 3 from the files and so on and so on</p>
  
  <p>raw file and the expected output are below:</p>
  
  <pre><code>WORKSTATION#JOB_NAME
  SCRIPTNAME "^TWSSCRIPTS^SCRIPT"
  STREAMLOGON "^TWSUSER^"
  -job JOB_NAME -user USER_ID -i JOB_ID
  RECOVERY STOP
  
  
  
  WORKSTATION#VBDSBQ_KFGP_SAPECC_PRGX_ACCNT_WKLY
  SCRIPTNAME "^TWSSCRIPTS^SCRIPT"
  STREAMLOGON "^TWSUSER^"
  -job VBDSBQ_KFGP_SAPECC_PRGX_ACCNT_WKLY -user MCMILS03 -i 8970597895
  RECOVERY STOP
  </code></pre>
  
  <p>this is as far as i got (again i know its crap)</p>
  
  <pre><code>file="/dir/dir/dir/file1"
  
  while IFS= read -r line
  do
  cat dummy_file | sed "s/JOB_NAME/$file1/" | sed "s/JOB_ID/$file2/" | sed "s/USER_ID/$file3"  #####this is where i get stuck as i dont know how to reference file2 and file3##### &gt;&gt;new_file.txt
  done
  </code></pre>