Skip to content

Instantly share code, notes, and snippets.

@hyoshiok
Created February 14, 2012 06:34
Show Gist options
  • Save hyoshiok/1824278 to your computer and use it in GitHub Desktop.
Save hyoshiok/1824278 to your computer and use it in GitHub Desktop.
unzip yammer message file to csv
#!/bin/bash
#
# unzip csv file
#
# usage
# $ ./unzip_csv.sh <export_message.zip>
#
# input format message_export_yyyymmdd-yyyymmdd.zip
# output format data/messages_yyyymmdd-yyyymmdd.csv
#
# 2/14/2012 hirotaka.yoshioka@mail.rakuten.com
#
ZIPFILE=$1
CSVFILE=`basename $ZIPFILE|sed -e "s/message_export_\([0-9]\{8\}\-[0-9]\{8\}\).zip/data\/messages_\1.csv/g"`
echo "ZIPFILE = $ZIPFILE"
echo "CSVFILE = $CSVFILE"
unzip -p $ZIPFILE > $CSVFILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment