Created
July 24, 2011 18:37
-
-
Save tmhedberg/1102924 to your computer and use it in GitHub Desktop.
List Arch Linux packages recently added to the system
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# List Arch Linux packages recently added to the system | |
# | |
# Usage: | |
# | |
# pacweek [<since>] | |
# | |
# Default interval is 1 week ago. | |
# | |
# Requires GNU date & combine from moreutils. | |
# | |
[[ $# -gt 0 ]] && | |
interval="$*" || | |
interval='1 week ago' | |
startd=`date -d "$interval" +%s` | |
parselog () { | |
awk -v sd=$startd -v pat=$1 ' | |
{ | |
sub(/^\[/, "", $1) | |
"date -d "$1" +%s" | getline d | |
} | |
d >= sd && $3 == pat { print $4 } | |
' /var/log/pacman.log 2>/dev/null | | |
sort | |
} | |
combine <(parselog installed) not <(parselog removed) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment