Awk

From Wiki
Jump to: navigation, search

Crear INSERTS per base de dades

 cat tamany.csv | awk -F "," {'print "insert into tamany values (\"" $1 "\",\"" $2 "\",\"" $3 "\"," $4 ",\"" $5 "\"); "'} > aa.sql

Sumar valors de la columna 2

 cat entrada.txt | awk '{ X+=$2; print X }'

Renombrar uns fitxers (escurçar-los)

ls | awk -F '_' {'print "mv \"" $0 "\" 1411RP-" $2'}
Personal tools
Namespaces
Variants
Actions
Navigation
Content
Toolbox