How to Import Text File into Journals?

I have a single text file with journal entries. Each line in the file has a date, entry and includes tags. Here’s an example:

2016-09-28 Window treatments installed #home 
2016-09-11 Painted kitchen #home #kitchen

Now that I am using Logseq, I would like to import this file. I can import it into a page but I thought I would follow Logseq’s design and import the entries into Journals. What is the quickest way to do this?

I can create individual .md files and place them in the journals folder but I have hundreds of entries and it is hard to split the one file into hundreds of files. Any suggestions?

This is a job for a script, to:

  • parse the single file
  • populate a data-structure
    • optionally apply some sorting
  • save it as multiple .md files
    • merge with existing ones, if any

Depending on the exact format, various simplifications may apply (e.g. if the input file already contains reliable sorting and/or grouping).

On linux (an maybe mac) you can use a shell script like this:

cat a.txt | while read line
  date=$(echo $line | cut -d' ' -f1)
  task=$(echo $line | cut -d' ' -f2-)
  echo "- $task" >> journals/$

Assuming that your tasklist is in a file a.txt and your current directory contains the journals subdirectory.
Afterwards you will need to reindex the graph.

However, as logseq links are bi-directional, you can just

  • set your date-format to yyyy-MM-DD
  • Copy your tasks into a single page
  • Enclose the dates in [[ ]]
  • Possibly re-index the graph
    and the tasks should appear in the querys of the correspondig journal-pages

PS: Create a backup before trying any of this.

Thank you mentaloid and elfrinjo. I used a script to create the MD files.