Last active
January 14, 2020 09:50
-
-
Save goooooouwa/175a2301eb9c4bd4dceefeed1ce2e306 to your computer and use it in GitHub Desktop.
break CardDiary export txt file into individual diary txt files with date as title. So that I can import these text files into Evernote.
This file contains hidden or 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
# 1. Split file by seperator | |
# Copy tab key as is, not using escape char. It will find “Date” and use it as separator and not delete it. | |
gcsplit --digits=2 --quiet --prefix=outfile CardDiaryTXT.txt "/ Date/" "{*}" | |
# 2. Rename file based on content | |
for filename in *; do | |
echo $filename | |
mv $filename "$(head -1 $filename | cut -c 8-17) $(echo $filename | cut -c 8-)".txt | |
done |
This file contains hidden or 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
Date: 2018-09-25 16:29:58 | |
Weather: Cloudy | |
Demo diary post 1 | |
Date: 2018-09-26 19:05:07 | |
Weather: Mostly Cloudy Day | |
Demo diary post 2 | |
Date: 2018-09-26 19:05:07 | |
Weather: Mostly Cloudy Day | |
Demo diary post 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment