#!/bin/sh
l=1 #this should be your starting scan number
k=100 #this should be your ending scan number
n=10 #this is the number of images per scan

###########DO NOT CHANGE BELOW THIS LINE##########
i=1
j=1
while [ $l -le $k ]
do
while ((j<=$n))
do
p=$(grep -nhr --include \CORRECT_$j.LP "total" run-$i/ | cut -d: -f1)
find run-"$i"/ -name "CORRECT_$j.LP" -print | xargs awk 'FNR == '$p' { print $10 >> "'Rmeas$j.txt'" }'  #<<EOF
let j=j+1
done 
let j=1
let i=i+1
let l=l+1
done