cat result.txt | grep -i -w "Scores: (#C #S #D #I)" | cut -c23- | awk '{print (($2 + $3 + $4)/($2 + $3 + $1))*100;}' > wer_lines.txt paste -d ' ' wikiniews_results.tsv wer_lines.txt > tmp.tsv cat tmp.tsv > wikiniews_results.tsv rm tmp.tsv