sexta-feira, 18 de julho de 2008

Shell: external variable in awk

awk -v x=0 'NF != 6 { ++x } END { print x, NR }' out.lst

This time we're passing awk an external variable. When you do this you have to tell awk what you're doing be prefixing the variable with -v. So we've initialized x to be equal to zero before actually starting our awk program.

Nenhum comentário:

Postar um comentário

Drunk Penguins

Drunk Penguins
Drunk Penguins