#!/usr/bin/gawk -f BEGIN{ comando="rexima" running="rexima -v" while(running|getline){ sub(", *",",") sub(/\[ \]/,"N") sub(/\[R\]/,"R") comando=comando " " $1 " " $2 if($3 == "R"){ comando=comando " " $1 " rec" } if($3 == "N"){ comando=comando " " $1 " norec" } } close(running) #print "#!/bin/sh" print comando }