// Aula 10 - Comandos Ășteis e avançandos com AWK # history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head # awk '/delimitador_inicial/,/delimitador_final/' arquivo.txt # dmidecode | awk '/Product Name/,/Manufacturer/' # vim arquivo.txt 45 45 5215 54106 5045 # awk '!x[$0]++' arquivo.txt # tail -15000 /var/log/apache2/access.log | awk '{print $1}' | sort | uniq -c | sort -n | tail # cat /var/log/syslog | awk '{print substr($0,0,12)}' | uniq -c | sort -nr | awk '{printf("n%s ",$0) ; for (i = 0; i<$1 ; i++) {printf("*")};}' # last | grep -v "^$" | awk '{ print $1 }' | sort -nr | uniq -c # apt install net-tools # netstat -ntu | awk '{print $5}' | cut -d: -f1,2 | sort | uniq -c | sort -n # netstat -ant | awk '{print $NF,$3,$4,$5}' | grep -v '[a-z]' | sort | uniq -c # du -d 1 | sort -r -n | awk '{split("KB(s) MB(s) GB(s)",v); s=1; while($1>1024){$1/=1024; s++} print int($1)" "v[s]"t"$2}'