SimpleNote DL & Sort by Tag in local


After exporting SimpleNotes


I'll create directories for each tags and organize them.


1. In the Simple Notes browser version (https://app.simplenote.com/)
In the upper left corner, click on the 三 menus → Settings → Tools → Export Notes

then the notes.zip file will be downloaded. 

2. unzip the zip, you will find that the notes are not sorted by tags
You will find a lot of information in notes/source/notes.json

You can also import this into SimpleNotes again

---

run this shell script in the directory full of text files under the notes directory

mkdir "Untagged Notes"
for f in *.txt
do
	if grep -q "Tags:" $f ; then
	tag=`tail -n 1 $f | xargs`
		mkdir "${tag}"
		mv $f "${tag}"
	else
   		mv $f "Untagged Notes"
	fi
done


--

tag=$(sed -ne '$p' ${f})


You can also use this to get the last line

--

Searching for other methods     Algorithm


Retrieve only the second-to-last line, and if it is not Tags:

(check line number) -1



wc

cat

cut

awk


sed

etc.. I was going to use


Check for the presence of certain characters


grep -q STRING FILE



--------


Improvements


I wanted to put symbolic links when there are more than two tags, but 



---



The content of the something.txt file is


Tags:

  study, planning


something like this


-

what is written in the json is


      "tags": [

        "write"

      ]


- - 

snt.py

import re
import subprocess

with open('./source/notes.json','r') as f:
        j = f.read()
        t = re.findall('"tags": \[
        "(.*)"
      \]', 'j')
        os.makedirs(t)

I'm not sure how to handle []    escape



ーー




ーー


My Current Notes Environment  Usage


Notes

Exporter


does not keep the creation time.

(Research required)

---


I've write too many

so I use SimpleNotes when outside

ーー


so long Japanese (original language) ver.

https://suityuri.blogspot.com/2021/07/snt.html