Last active
December 31, 2020 11:51
-
-
Save boydkelly/9ecb5b45ea5a7d778ef2eec34fa841cd to your computer and use it in GitHub Desktop.
export gnote or tomboy files to asciidoc
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
#!/usr/bin/bash | |
ext=.g.adoc | |
for x in `ls *.note`; do | |
changedate=`xml_grep last-change-date "$x" --text` | |
out=`date -d $changedate +%Y-%m-%d`- | |
out=$out-`xml_grep title "$x" --text|sed 's/ /_/g' | tr '[:upper:]' '[:lower:]'`"${ext}" | |
xml_grep title "$x" --text > $out | |
xml_grep text "$x" --text >> $out | |
sed -i '1 s/^/= /' $out | |
sed -i "2 i :date: $changedate" "$out" | |
sed -i '2 a #;' "$out" && sed -i 's/^#;//g' "$out" | |
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
#!/usr/bin/bash | |
ext=.t.adoc | |
for x in `ls *.note`; do | |
changedate=`xml_grep last-change-date "$x" --text` | |
out=`date -d $changedate +%Y-%m-%d`- | |
out=$out-`xml_grep title "$x" --text|sed 's/ /_/g' | tr '[:upper:]' '[:lower:]'`${ext} | |
xml_grep note-content "$x" --text > $out | |
sed -i '1 s/^/= /' $out | |
sed -i "2 i :date: $changedate" $out | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
requires perl xml twig package available on all main distros. .note files are slightly different between gnote and tomboy.