Si todo es como he entendido este script te puede funcionar: #!/bin/bash
# $0: ejecutable # $1: fichero # $2: var1 o var2 # $3: cadena a añadir if [ $# -ne 3 ] then echo "Error en el numero de argumentos" echo "Uso: $0 fichero var1|var2 cadena" exit -1 fi if [ $2 == "var1" ] then cat $1 | awk -v texto=$3 '{print $1 " " texto " " $3 " " $4 " " $5 " " $6 " " $7 }' > $1 exit 0 fi if [ $2 == "var2" ] then cat $1 | awk -v texto=$3 '{print $1 " " $2 " " $3 " " $4 " " $5 " " $6 " " texto }' > $1 exit 0 fi Pero ten en cuenta que está muy limitado para la estructura de fichero que has dado, es decir, si la modificas no te servirá :S A alguien se le ocurre algo más elegante que mi chapucilla?? -- Fernando Blat Peris http://ttt.inf.upv.es/~ferblape Polinux <http://polinux.upv.es> UPV - Valencia