Random Awk Shit

From Federal Burro of Information
Revision as of 01:28, 4 May 2024 by David (talk | contribs)
Jump to navigationJump to search

show total disk space used for all use devices

df -k | awk 'BEGIN { one = 0 ; used = 0 ; avail = 0 }/dev/{one = one + $2 ; used = used + $3 ; avail = avail + $4 }END { print "total\ttotal\ttotal" RS "1kblocks", "used", "avail" RS one, used, avail, used/one, avail/one }'
cat ssl_request_log | awk 'BEGIN{FS=":"}{freq[$1":"$2]++}END{for(word in freq) print word, freq[word]}' | sort