-
Notifications
You must be signed in to change notification settings - Fork 10
/
gnote-export-to-txt.sh
52 lines (46 loc) · 1.27 KB
/
gnote-export-to-txt.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
#VARIABLE DEFINITIONS AND DEFINITION CHECKS
#============================================
echo .starting with definitions....
cd $HOME/.local/share/gnote/
ls
_dest="$HOME/.local/share/gnote/"
#_file="simple_desktop_creator.desktop"
#_focus=$_dest$_file
echo "everything went ok."
echo
echo " Path Test......... "
echo ...directory:
echo "$_dest"
cd "$_dest"
for f in *.note
do
echo "$f"
mkdir -p gnote-notes-in-txt
mkdir -p gnote-notes-in-txt/title
mkdir -p gnote-notes-in-txt/ok
xml_grep 'note-content' "$f" --text_only >> gnote-notes-in-txt/"$f".txt
xml_grep 'title' "$f" --text_only >> gnote-notes-in-txt/title/"$f".titleonly.txt
cd gnote-notes-in-txt
rename 's/.note.txt/.txt/' *
cd ..
done
#fixing titles
cd gnote-notes-in-txt
for f in *.txt
do
echo "fixing title for $f"
cp -a -u "$f" ok/"`head -1 "$f"`.txt"
done
cd ..
rm -R gnote-notes-in-txt/title
mkdir -p gnote-notes-in-txt/raw-export-backup
echo "local dir es"
ls
mv gnote-notes-in-txt/*.txt gnote-notes-in-txt/raw-export-backup
mv gnote-notes-in-txt/ok/*.txt gnote-notes-in-txt/
rm -R gnote-notes-in-txt/ok/
rm -R gnote-notes-in-txt/raw-export-backup/
cd $HOME/.local/share/gnote/
zip -r gnote2txt.zip gnote-notes-in-txt/
cd