Insertar string antes de cada linea de un archivo

Alvaro Herrera alvherre en alvh.no-ip.org
Mar Abr 17 15:49:48 CLT 2007


Juanjo escribió:
> On 4/17/07, Cristian Farias <mail en cristianfarias.cl> wrote:
> >
> >cat test | awk '{print "string " $1}'
> 
> Para que gastar recursos en un cat, cuando awk lee archivos?
> 
> awk '{print "string " $0;}' test
> 
> Asi te proteges de las lineas con blancos, pero te queda el problema
> de las comillas como ejercicio para la casa. hint: usar printf.

$ awk '{print "string " "\"" $0 "\""}' test

-- 
Alvaro Herrera                        http://www.advogato.org/person/alvherre
"Executive Executive Summary: The [Windows] Vista Content Protection
 specification could very well constitute the longest suicide note in history."
      Peter Guttman, http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt


Más información sobre la lista de distribución Linux