#!/usr/bin/env bash
resultFile=$1
if [ "$#" -ne 1 ]; then
  resultFile=`ls -t run_petsc.sh.o* -1 | head -n 1`;
  echo "Using most recent output file: ${resultFile}"
fi

tmpMat=petsc_run_err_mat_name.txt
tmpNorm=petsc_run_err_norm.txt
tmpTime=petsc_run_out_time.txt
result=result.out

grep 'nnz =' ${resultFile} -B 1 | grep -v 'nnz' | grep -v '-' > ${tmpMat}
grep 'Norm of error' ${resultFile} | sed 's/Norm of error //g' | sed 's/ Iterations //g' > ${tmpNorm}
grep 'Time (sec):' ${resultFile}  | sed 's/Time (sec):           //g' | sed 's/      /,/g' | sed 's/   /,/g' > ${tmpTime}
paste -d"," ${tmpMat} ${tmpNorm} ${tmpTime} > ${result}

rm -f ${tmpMat} ${tmpNorm} ${tmpTime}

Add script to parse PetSC results
Add script to parse PetSC results
