Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
latest_date_file=.last-statement-date
while [[ $# -gt 1 ]]
do
key="$1"
case $key in
-s|--since)
since="$2"
shift # past argument
;;
*)
# unknown option
;;
esac
shift # past argument or value
done
if [ -f $latest_date_file -a -z "$since" ]; then
read -r since<$latest_date_file
fi
rm -f $latest_date_file
export_statements \
--district MD-6 \
--district VA-9 \
--district GA-7 \
--district OH-2 \
--district GA-13 \
--district WV-3 \
--district NC-12 \
--district KY-5 \
--district GA-11 \
--district SC-5 \
--district VA-6 \
--district NC-10 \
--district NC-5 \
--district KY-1 \
--district TN-1 \
--district TN-6 \
--district MS-2 \
--district PA-10 \
--district SC-3 \
--district VA-10 \
--district WV-1 \
--district AL-4 \
--district NY-22 \
--district OH-14 \
--district TN-3 \
--district NC-9 \
--district MS-1 \
--district SC-4 \
--district MD-8 \
--district OH-7 \
--district PA-5 \
--district AL-6 \
--district PA-18 \
--district NY-20 \
--district GA-3 \
--district TN-4 \
--district GA-4 \
--district GA-9 \
--district KY-2 \
--district OH-13 \
--district PA-11 \
--district GA-14 \
--district PA-17 \
--district PA-3 \
--district NY-24 \
--district NC-6 \
--district WV-2 \
--district KY-4 \
--district MS-3 \
--district NY-19 \
--district OH-15 \
--district GA-10 \
--district NC-11 \
--district KY-6 \
--district PA-9 \
--district OH-12 \
--district PA-15 \
--district VA-5 \
--district PA-14 \
--district GA-6 \
--district NY-23 \
--district TN-2 \
--district AL-5 \
--district AL-2 \
--district OH-10 \
--district NY-27 \
--district AL-3 \
--district AL-7 \
--district PA-12 \
--district TN-7 \
--district OH-6 \
--since $since | \
tee >(./get_latest_date.sh $latest_date_file)
if [ ! -f $latest_date_file ]; then
echo "$since" > $latest_date_file
fi
#!/bin/bash
latest_date_file=$1
if [ -z "$latest_date_file" ]; then
latest_date_file=.last-statement-date
fi
cat <&0 | csvcut -c date | head -n 2 | tail -n 1 > $latest_date_file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.