AWK
1、== != < > <= >=
awk '$1=="str"{print}' filename
awk '$1>$2 {print}' filename
2、~ !~
awk '$1~/str/ {print}' filename
awk '$1!~/str/{print}' filename
awk '/^str/{print}' filename
awk '/str$/{print}' filename
3、&& || !
awk '$1=="str1" && $2=="str2"{print}' filename
awk '$1~/str1/ || $2~/str2/ {print}' filename
4、不同操作之间以“;”隔开
awk '{a=$1; b=$2; print $3}' filename
5、for循环(不同的操作块以“{}”隔开)
awk '{for(i=1;i<=NF;i++) print $i}' filename
awk '{a=$1;for(i=1;i<=NF;i++) {j=i+1; print j}; print a}'
6、if...else
awk '{if() print}' filename
awk '{if() print; else print}' filename 或者 awk '{if(){print}esle{print}}' filename