Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sharing your after-exporting JQ command here #4493

Open
Gitbreast opened this issue Nov 6, 2024 · 0 comments
Open

Sharing your after-exporting JQ command here #4493

Gitbreast opened this issue Nov 6, 2024 · 0 comments

Comments

@Gitbreast
Copy link

Gitbreast commented Nov 6, 2024

You can share your jq command used after exporting here. I think pasting all the jq command to one issue is better for searching, for some newbies like me.
I run the jq command below in Unix shell (macOS, etc) and it works, inspired by @ocean #4461 (comment).
But I cannot make this jq works in Windows. If you've done it, come on and share it here for others.
How to export: https://docs.omnivore.app/using/exporting.html
Below is the original post.


This is a jq command with a little fine-tune for converting to.xlsx format and .md format, and I add links to local files by =HYPERLINK() command.

Tips: The jq command can directly run in Unix shell such like macOS terminal, but it cannot directly work in windows cause the “quote problem”. You can fine-tune it and give it a try, check: https://jqlang.github.io/jq/manual/

Follow these steps to .xlsx (in macOS):

  1. Follow these official steps. Download your Omnivore ZIP. Unzip it.
  2. Enter the folder, right click the folder name on the bottom bar, choose “open in terminal”.
  3. Paste these code in the terminal and press enter.
jq -r '
  (["Tags","Title","Description","Created","File","URL"]), 
  (.[] | [
    ([.labels[]?]|join(",")),
    (.title | gsub("\\n";" ") | gsub("\\r";" ") | gsub("\"";"''") | gsub("[^[:print:]]";" ") | gsub("\\s+";" ")),
    (.description | gsub("\\n";" ") | gsub("\\r";" ") | gsub("\"";"''") | gsub("[^[:print:]]";" ") | gsub("\\s+";" ")),
    .savedAt,
    ("=HYPERLINK(G1&\"\\content\\" + .slug + ".html\" ,\"Open\")"),
    .url
  ]) | @csv
' metadata_*.json > omnivore-export.csv
  1. You should see the omnivore-export.csv file appears in the same folder. Open it with Numbers App.
  2. In Numbers’s menu, click "Files > Export As > Excel…" , next step, export.
  3. You should see the omnivore-export.xlsx file appears in the same folder.
  4. Transport the folder to a windows PC. Open the .xlsx with Excel.
  5. Copy the folder path in windows, and paste it to the G2 cell in Excel.
  6. Now click a random "Open" button in column E, you should open a local html file.

PS. I cannot make the links in .xlsx work in macOS, but they work in windows, you can give it a try.

Eventually, it looks like this, I covered the text, notice G2 and column E:

image

And here’s a version for Markdown .md. Get the .csv file and drop it to an online converter like this. Markdown softwares are slow at so much data though.

jq -r '
  (["Tags","Title","Description","Created","File","URL"]), 
  (.[] | [
    ([.labels[]?]|join(",")),
    (.title | gsub("\\n";" ") | gsub("\\r";" ") | gsub("\"";"''") | gsub("[^[:print:]]";" ") | gsub("\\s+";" ")),
    (.description | gsub("\\n";" ") | gsub("\\r";" ") | gsub("\"";"''") | gsub("[^[:print:]]";" ") | gsub("\\s+";" ")),
    .savedAt,
    ("[Open](.\\content\\" + .slug + ".html)"),
    .url
  ]) | @csv
' metadata_*.json > omnivore-export.csv
@Gitbreast Gitbreast changed the title Sharing your after-exporting jq command here Sharing your after-exporting JQ command here Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant