Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 28 lines (21 sloc) 432 Bytes
#!/bin/sh
## Show entries for given day.
## Author: Przemyslaw Pawelczyk
LOGFILE="$HOME/.log"
if [ $# -eq 0 ]; then
echo "Usage: $0 [-a] DATE..."
exit 0
fi
TRANSFORM="sed \$!{1!d}"
if [ "$1" = "-a" ]; then
TRANSFORM=cat
shift
fi
NOW="$(date +"%FT%T%z NOW")"
while [ $# -gt 0 ]; do
PATT="$1"
shift
[ "$PATT" = "today" ] && PATT="$(date +%F)"
grep "$PATT" "$LOGFILE" | sort | $TRANSFORM
echo "$NOW" | grep "$PATT"
done