Import from BEAR App

Hi, I’m new to Obsidian but have been using several note taking apps for years.
Before Obsidian, I used BEAR. But I had to migrate to Windows and thus I need some cross platform note taking app now.

My import workflow (From MAC BEAR to WINDOWS Obsidian):

  1. Export from BEAR as Markdown+Attachments to a Dropbox Folder “notes”
  2. Create an “attachment” folder under “notes” folder (“notes/attachments”)
  3. Move all folders beneath “notes” folder, to this new “attachments” folder.
  4. Fix all inline image links, running the code below on a shell opened on the “notes” folder:

find . -type f -name "*.md" -exec bash -c "sed -E 's/\!\[\]\(/\!\[\]\(attachments\//' '{}' > tempfile; touch -r '{}' tempfile; mv tempfile '{}'" \;

This way, all inline images get properly linked to the new attachments folder, and the creation/modified timestamps are preserved. I’m no shell ninja so please PLEASE if you do use this, make some backups !

So far, I’m loving Obsidian. Good job guys and gals! Other than a more polished UI, the one thing that is nagging me is that BEAR allowed attachments of any type. Still thinking what to do with those in Obsidian.

11 Likes

Hey! Thanks for this. Do you know how to fix the linking with tags? At the moment, all the tags work, but they open the Bear app when I would want it to open in Obsidian. :slight_smile:

Hi, can you provide some examples?

If you linked a Bear note to another Bear note, it looks something like this:
[1 September](bear://x-callback-url/open-note?id=DBDBB013-E5DA-4204-9F67-C7357F814134-1065-00007739A86EBF2F)

I’m sorry, didn’t see this reply… did you manage to fix this?

This worked flawlessly for me, thanks! Should it be added to Obsidian’s Help vault? It describes how to import from other systems, but not from Bear.

1 Like

This has worked great for me!

2 Likes

Hi @linxule and others, I saw your reply to my fork on Github. Thanks for the mention.

I would love to help with automation (I want to try with Cron) but I’ve not yet come to that point. My synching does not yet work flawlessly enough. Let me elaborate what I did so far to get it working…

First… Attachments like PDF, docx were not synched with Andy’s script. Alex Kessinger (Voidfiles on Github) created a adaptation of the script to provide for this:

Also I noticed that all the files were copied to their respective tagfolders but also (all) to the root of the Vault. Whatever I tried in the script it always was like that. I couldn’t figure out why (ideas are welcome) and I’ve found it confusing to see notes in two places in Obsidian.
Voidfiles came again to the rescue and helped me with a few extra lines.

He suggested to change the following line around line 281:
paths = [os.path.join(temp_path, filename)]
to this

    if tags:
     paths = []
    else:
     paths = [os.path.join(temp_path, filename)]

Now my Bear tag index looked the same as my Obsidian folders. I set the script to only copy the notes to the first tags in the note, again to prevent duplication.

But the problems I’m experiencing are:

  • Some images in notes that look perfectly fine in Bear are not displayed in Obsidian
  • Attachment links are not working in Obsidian
  • If I add a picture or attachment in Obsidian they don’t show up in Bear after a sync.

It would be great if this thread could become a ‘study group’ how to be able to use Bear and Obsidian simultaneously. Thanks!

1 Like

@janpeeters Thank you for the reply! I will check out the script for syncing attachments. Mainly I have been using external links for attachments and my attachments are just images.

Overall, Obsidian and Bear complements each other in many ways. I like how Ness Lab talks about different note-taking apps in this blog:

  • Obsidian is for Gardeners: “to the process of simultaneously exploring and building a map in a video game”
  • Bear is for Librarians: “quickly save and access what you need, whether it’s some book notes, meeting notes, or a recipe”
2 Likes

This shell command doesn’t work properly when I try it. Here is a sample of the error output. Any thoughts? I receive the same error with the command in my normal fish shell as well.

[email protected]~/D/!/bearnotes> bash
bash-5.1$
bash-5.1$ cd ~/Downloads/\!tmpdown/bearnotes/
bash-5.1$ find . -type f -name "*.md" -exec bash -c "sed -E 's/\!\[\]\(/\!\[\]\(attachments\//' '{}' > tempfile; touch -r '{}' tempfile; mv tempfile '{}'" \;
bash: -c: line 1: unexpected EOF while looking for matching `''
bash: -c: line 2: syntax error: unexpected end of file
sed: ./Beyond: No such file or directory
sed: the: No such file or directory
sed: pale - the meaning and origin of this phrase.md: No such file or directory
touch: ./Beyond: No such file or directory
usage: mv [-f | -i | -n] [-v] source target
       mv [-f | -i | -n] [-v] source ... directory
bash: -c: line 1: unexpected EOF while looking for matching `''
bash: -c: line 2: syntax error: unexpected end of file
bash: -c: line 1: unexpected EOF while looking for matching `''
bash: -c: line 2: syntax error: unexpected end of file
bash: -c: line 1: unexpected EOF while looking for matching `''
bash: -c: line 2: syntax error: unexpected end of file
bash: -c: line 1: unexpected EOF while looking for matching `''
bash: -c: line 2: syntax error: unexpected end of file
bash: -c: line 1: unexpected EOF while looking for matching `''
bash: -c: line 2: syntax error: unexpected end of file
bash: -c: line 1: syntax error near unexpected token `('
bash: -c: line 1: `sed -E 's/\!\[\]\(/\!\[\]\(attachments\//' './KUAC - Shakespeare's Words (and Phrases).md' > tempfile; touch -r './KUAC - Shakespeare's Words (and Phrases).md' tempfile; mv tempfile './KUAC - Shakespeare's Words (and Phrases).md''
^C

Hi, I think that the shell script doesn’t work with file names with apostrophes. Probably other special characters…

Right, @clothstir try the syntax below instead. Filenames with spaces, single quotes, double quotes etc should be handled properly:

$ find . -type f -name "*.md" -exec bash -c 'sed -E "s/\!\[\]\(/\!\[\]\(attachments\//" "$1" > tempfile; touch -r "$1" tempfile; mv tempfile "$1"' -- {} \;

1 Like

That was it! Thanks!

Hi @luckman212 ,

I’m trying to get the attachments to show up under the respective notes after I exported my notes from Bear and placed them in a sub directory as defined by the 1st post in this thread by Pda0. I’ve tried for a few hours but cannot get the attachments to show up in the respective notes. I’ve tried @Pda0’s code and your’s as well, but no luck. My image links aren’t coming into Obsidian. Any tips or a script I can use? Below is an example of the image link that isn’t working. I have my vault in a “notes” folder and the subdirectory of “attachments”.

Thank you for your help!

Hm, I’m new in Obsidian - and completely confused.
I like to import Bear notes. On this page, which is recommended, i don’t see a help.
I use both on Mac
And I also don’t find how to manage Obsidian at all (e.g. import something).
And last but not least my English is worse - sorry for that.

Sorry for the noob question but I don’t know anything about programming. Where would I have to paste that code? Within Obsidian, in the Command Palette?
I wouldn’t mind moving the folders manually into the attachment folder, but the auto-link-updater changes the modified date.
Thank you in advance!

It’s unclear which approach works reliably, with the most success. There’s the first approach of using Bear’s built-in export feature, which I assume can also work directly from iOS not just Mac. There’s the second approach of using Andy’s script to extract from the SQLite database on Mac. There are a variety of cleanup scripts and fixes for cleanup scripts.

Also, nobody in this thread has mentioned the official Markdown converter plugin that has support for converting Bear’s highlighting syntax (and maybe that’s all it does??).

It seems like plenty of people have migrated from Bear to Obsidian, but the impression I get is that it’s a potentially messy process, and I’m guessing it’s also potentially lossy in ways that aren’t well understood. Things like unsupported attachment types, nested and multi-word tags, etc. Edit: looks like nested tags are now supported.

Is there an updated best practice for migrating from Bear? Do you really need to muck with changing attachment folder structure? Any recommendations on the pros and cons of trying to keep tags from Bear? Do links between Bear notes “just work” in Obsidian?