X-Git-Url: https://arthur.barton.de/gitweb/?p=iPhone2Mac.git;a=blobdiff_plain;f=iPhone2Mac.sh;h=4070cc60c5b0d419683e6b0afd2183e0a096a8bf;hp=0cf3ea44b554a9e829f169b672d58cdaf49cd0db;hb=7e46d2040a696f7475dcf34c56bd394a4a6c1f8d;hpb=7a9dd0dee125949af48d112fb5d043706f23ad8b diff --git a/iPhone2Mac.sh b/iPhone2Mac.sh index 0cf3ea4..4070cc6 100755 --- a/iPhone2Mac.sh +++ b/iPhone2Mac.sh @@ -1,7 +1,7 @@ #!/bin/bash # # iPhone2Mac -- save call logs from iPhone backups -# Copyright (c)2009 Alexander Barton (alex@barton.de). +# Copyright (c)2009-2011 Alexander Barton (alex@barton.de). # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -53,13 +53,27 @@ import_d() { fi for f in $call_db; do verbose "Dumping SQLite call databse \"$f\" ..." - sqlite3 "$f" "select * from call;" >>"$CALL_TMP" + sqlite3 "$f" "select * from call;" | while read row; do + IFS="|" + arr=($row) + unset IFS + + rowid=${arr[0]} + address=${arr[1]} + date=${arr[2]} + duration=${arr[3]} + flags=${arr[4]} + id=${arr[5]} + + echo "$date|$rowid|$address|$duration|$flags|$id" \ + >>"$CALL_TMP" + done done verbose "Sorting plain ASCII call log ..." - sort -u "$CALL_TMP" >"$CALL_LOG" + sort -un "$CALL_TMP" >"$CALL_LOG" rm -f "$CALL_TMP" - first_d=$(date -r `head -1 "$CALL_LOG" | cut -d'|' -f3` "+%Y-%m-%d %H:%M") - last_d=$(date -r `tail -1 "$CALL_LOG" | cut -d'|' -f3` "+%Y-%m-%d %H:%M") + first_d=$(date -r `head -1 "$CALL_LOG" | cut -d'|' -f1` "+%Y-%m-%d %H:%M") + last_d=$(date -r `tail -1 "$CALL_LOG" | cut -d'|' -f1` "+%Y-%m-%d %H:%M") message `wc -l "$CALL_LOG" | awk '{print \$1}'`" unique entries logged, from $first_d to $last_d." }