/via: https://www.howtogeek.com/562941/how-to-use-the-awk-command-on-linux/
print
BEGIN
y END
se ejecutan antes y después de procesar el texto, en su propio ámbito { }awk -F: '$3 >= 1000 {print $1,$6}' /etc/passwd
awk '/UUID/ {print $0}' /etc/fstab
awk '/^UUID/ {print $0}' /etc/fstab
#!/usr/bin/awk -f BEGIN { # set the input and output field separators FS=":" OFS=":" # zero the accounts counter accounts=0 } { # set field 2 to nothing $2="" # print the entire line print $0 # count another account accounts++ } END { # print the results print accounts " accounts.\n" }
chmod +x omit.awk ./omit.awk <file>
awk '{ if ( NF == 3 ) print } ' /path/to/input
seq 1 10 | awk 'NR==1 { MIN=$1; next } $1 < MIN { MIN=$1 } END{ print MIN }'
seq 1 10 | awk 'NR==1 { MAX=$1; next } $1 > MAX { MAX=$1 } END{ print MAX }'
seq 1 10 | awk '{ SUM+=$1 } END { print SUM/NR}'
awk '{ $1=""; $2=""; print}' filename
awk -F':' '{ $1=""; $2=""; print}' filename
awk '/^[a-f0-9]{1,7}\s+/ {print $5}'