awk ' /^\.XX/ { if($2 ~ /[a-z]/){ name=$2 first=$3 str = "..\/" $4 ".pg" getline <str last=$1 + first -1 print name " " first " " last } }' ../contents/contents.ms >contents