Random Awk Shit: Difference between revisions

From Federal Burro of Information
Jump to navigationJump to search
(New page: # 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\ttot...)
 
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
# show total disk space used for all use devices
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 }'
  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
  cat ssl_request_log | awk 'BEGIN{FS=":"}{freq[$1":"$2]++}END{for(word in freq) print word, freq[word]}' | sort
[[Category:Script]]

Latest revision as of 14:26, 24 July 2024

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