Useful jq information for jrnl
several snippets of useful jq knowledge
Here are some links that helped me to figure out how to take multiple JSON files (that I am going to want to generate from jrnl) and combine them. Because of that, I also needed to make sure that I could remove duplicate (time entries) from them, as how I need to do a -contains command, it is extremely likely that I'll get duplicate entries with the same date and time, so, I wanted to remove them (obviously).
Using the command line, I used the what I learned (and then created a new jq script file) to test that it worked. It does, so ... Happy days.
#### -- how to take multiple jrnl json export files and combine them into 1
jq 'reduce inputs.entries as $s (.; .entries += $s)' tmp2.json tmp3.json > test.json
#### -- take file with possible duplicates and convert them to markdown
cat test.json | jq -r -f ~/.mike/my_setup/bin/jq-scripts/jq-2-md-uniq.jq > ./test.md
Will want to modify what I'm doing in the clui-jrnl script to allow multiple entries to be entered that will end up being individual jrnl -contains xx commands that will save to a json file and then will combine those and then convert it to markdown.
This is what I'm doing in export_jrnls_md script. It isn't using any -contains xxx commands but it shows how I was using it (for completness), so ...
jrnl ${JRNL_DATE_FROM} --export json $jrnl | jq -r -f /Users/$(whoami)/.mike/my_setup/bin/jq-scripts/jq-2-md.jq > ./"$JOURNAL".md
That should be enough to make a better command given what I want to do and the information above.