Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 6th, 2012  |  syntax: None  |  size: 0.57 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/bin/bash
  2.  
  3. # List Arch Linux packages recently added to the system
  4. #
  5. # Usage:
  6. #
  7. #     pacweek [<since>]
  8. #
  9. # Default interval is 1 week ago.
  10. #
  11. # Requires GNU date & combine from moreutils.
  12. #
  13.  
  14. [[ $# -gt 0 ]] &&
  15.     interval="$*" ||
  16.     interval='1 week ago'
  17. startd=`date -d "$interval" +%s`
  18.  
  19. parselog () {
  20.     awk -v sd=$startd -v pat=$1 '
  21.         {
  22.             sub(/^\[/, "", $1)
  23.             "date -d "$1" +%s" | getline d
  24.         }
  25.         d >= sd && $3 == pat { print $4 }
  26.     ' /var/log/pacman.log 2>/dev/null |
  27.     sort
  28. }
  29.  
  30. combine <(parselog installed) not <(parselog removed)