20190136awk

Source

awk

head -n2 test.txt|awk -F ‘:’ ‘{print $1}’
head -n2 test.txt|awk -F ‘:’ ‘{print $0}’
awk -F ‘:’ ‘{print $1"#"$2"#"$3"#"$4}’
awk ‘/oo/’ test.txt
awk -F ‘:’ ‘$1 ~/oo/’ test.txt
awk -F ‘:’ ‘/root/ {print $1,$3} /test/ {print $1,$3}’ test.txt
awk -F ‘:’ ‘$1 ~ /root/ {print $1,$3} $1 ~ /test/ {print $1,$3}’ test.txt
awk -F ‘:’ ‘$3==“0”’ /etc/passwd
awk -F ‘:’ ‘$3>=“500”’ /etc/passwd
awk -F ‘:’ ‘$3>=500’ /etc/passwd
awk -F ‘:’ ‘$7!="/sbin/nologin"’ /etc/passwd
awk -F ‘:’ ‘$3<$4’ /etc/passwd
awk -F ‘:’ ‘$3>“5” && $3<“7”’ /etc/passwd
awk -F ‘:’ ‘$3>1000 || $7=="/bin/bash"’ /etc/passwd
head -5 /etc/passwd |awk -F ‘:’ '{OFS="#"} {print $1,$3,$4}‘
== awk -F ‘:’ ‘{OFS="#"} {if ($3>1000) {print $1,$2,$3,$4}}’ /etc/passwd==
head -n3 /etc/passwd | awk -F ‘:’ '{print NF}‘
head -n3 /etc/passwd | awk -F ‘:’ '{print NR}‘
awk ‘NR>40’ /etc/passwd
awk -F ‘:’ ‘NR<20 && $1 ~ /roo/’ /etc/passwd
head -n 3 /etc/passwd |awk -F ‘:’ '$1=“root”‘
awk -F ‘:’ ‘{(tot=tot+$3)}; END {print tot}’ /etc/passwd
awk -F ‘:’ ‘{if ($1==“root”) {print $0}}’ /etc/passwd
awk -F ‘:’ '{OFS="#" } $1=“root” ’ test

awk -F ‘:’ {(sum+=$3)}; END {print sum}’ test