Skip to content

Instantly share code, notes, and snippets.

@ecarreras
Last active December 17, 2015 07:48
Show Gist options
  • Save ecarreras/5575224 to your computer and use it in GitHub Desktop.
Save ecarreras/5575224 to your computer and use it in GitHub Desktop.
for i in `seq $1 $2`; do
LOG_FILE="postgresql-8.3-main.log.$i"
GZIP=false
if [ ! -f $LOG_FILE ]; then
LOG_FILE=$LOG_FILE.gz
GZIP=true
if [ ! -f $LOG_FILE ]; then
echo "***ERR: No $LOG_FILE found."
exit 2
fi
fi
echo "Searching in $LOG_FILE...";
CMD="pv $LOG_FILE"
if [ $GZIP == true ]; then
CMD="$CMD | gzip -d"
fi
CMD="$CMD | grep -H $3"
eval $CMD
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment