#!/bin/bash
#===============================================================================
#
#          FILE: check_family_town_recycled
#
#         USAGE: check_family_town_recycled <Family ID>
#
#   DESCRIPTION: Check if the family town recycled
#
#       OPTIONS: <Family ID>
#
#  REQUIREMENTS:
#
#         NOTES:
#
#          BUGS:  ---
#        AUTHOR: rickz (Rick Zhang), xlrickz@gmail.com
#       COMPANY: X-LEGEND Entertainment Corp.
#       CREATED: Wed Feb 29 18:49:06 KST 2012
#      REVISION: 1.0
#
#          TODO:
#
#===============================================================================

#set -o nounset                              # Treat unset variables as an error
#set -m                                      # Enable job control

source ~/.gamerc

[ "$1" == "" ] && exec echo "Usage: check_family_town_recycled <Family ID>"

xcat ~/servers*/Log/*/Mission*/FamilyItem* ~/servers*/Mission*/FamilyItem*|\
egrep "Recycled|OnlineMember"|grep "FM\[$1[^0-9]"|awk -F, '{print $2","$4}'|\
sed 's/TownSize.*//g;s/FM/FamilyID/g'|highlight - Recycled OnlineMember.* "FamilyID.$1." 
