Skip to content

Instantly share code, notes, and snippets.

@yllan
Created February 18, 2011 08:31
Show Gist options
  • Save yllan/833413 to your computer and use it in GitHub Desktop.
Save yllan/833413 to your computer and use it in GitHub Desktop.
grab the folder under each AppId before $YESTERDAY (include)
#!/bin/bash
. /etc/bashrc
. /etc/profile
MONTHAGO=`date --date='31 day ago' +%Y/%m/%d` # Linux
#MONTHAGO=`date -v -31d +%Y/%m/%d` # BSD
/mnt/lib/hadoop/bin/hadoop fs -lsr /log_data | awk -F/ "NF==6" | grep -E "[0-9]{4}/[0-9]{2}/[0-9]{2}$" | awk -F/ "\$4\"/\"\$5\"/\"\$6 < \"$MONTHAGO\"" | awk '{print $8}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment