Last active
July 27, 2021 07:38
-
-
Save ujaehrig/5a0ba51985903d5b66e4796cd59aa395 to your computer and use it in GitHub Desktop.
Script to prepare an Fritz!Box Anrufliste.csv to a format suitable for DB import
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Remove first line (having the separator indicator) | |
# Change date from "dd.MM.yy hh:mm" to "yyyy-MM-dd hh:mm:ss" (with second always 00) | |
# Change duration from "hh:mm" to "hh:mm:ss" (with seconds always 00) | |
cat | | |
tail -n +2 | | |
sed -e 's/;\(..\)\.\(..\)\.\(..\) \(..:..\);/;20\3-\2-\1 \4:00;/g' | | |
sed -e 's/:\([0-9]\{2\}\)$/:\1:00/g' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Remove separator indicator | |
# Change date from "dd.MM.yy hh:mm" to "yyyy-MM-dd hh:mm" | |
# Change separator ; to , | |
grep -v '^sep=;$' | | |
sed -e 's/;\(..\)\.\(..\)\.\(..\) \(..:..\);/;20\3-\2-\1 \4;/g' | | |
xsv fmt -d';' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment