Skip to content

Instantly share code, notes, and snippets.

@peplin
Created April 23, 2010 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peplin/376806 to your computer and use it in GitHub Desktop.
Save peplin/376806 to your computer and use it in GitHub Desktop.
Migrate from Klok to Timetrap
#!/bin/bash
#
# Christopher Peplin
# chris.peplin@rhubarbtech.com
#
# A litte script to migrate from Klok to Timetrap.
# Use the "download all time entry data" option in Klok for each project you wish to convert
# to a timesheet in Timestop. The copy and paste (or by some other method)
# convert their HTML table to plain text, with the fields separated by tabs.
#
# This script will then take the plaintext as input and run "t in" and "t out"
# for each entry.
#
# $ ./klok-to-timtrap.sh <text dump from Klok> <destination timesheet in Timetrap>
KLOKDUMP=$1
TIMESHEET=$2
t switch $TIMESHEET
IFS=";";
for ENTRY in `awk -F'\t' '{print "t in --at \"", $2, $3, "\"", "\"", $1, "\"", "&& t out --at \"", $2, $4, "\";"}' $KLOKDUMP`
do
echo $ENTRY
eval $ENTRY
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment