3 ms·
Tables are fairly easy to extract from org-files, even with some sed/awk function, e.g. `getOrgTable() { awk -vT=$1 '/^#\+NAME: /&&$2~T{f=1;next};/----/{next};!
by stragies 5y ago
Tables are fairly easy to extract from org-files, even with some sed/awk function, e.g. `getOrgTable() { awk -vT=$1 '/^#\+NAME: /&&$2~T{f=1;next};/----/{next};!/^\|/{f=0};f' $2 ; }`
The above should work for most tables, and you get back a pipe-separated-values output, that you could further refine with e.g. http://harelba.github.io/q/ http://harelba.github.io/q/ to get tsv,csv output support and SQL query capabilities.
I regularly SQL-Query with INNER JOINs over tables in various org-files stored on multiple servers in one commandline using this combination.
John Kitchin has a description for a "cleaner" way to do it here:
https://kitchingroup.cheme.cmu.edu/org/2014/08/11/Using-org-mode-outside-of-Emacs---sort-of.org https://kitchingroup.cheme.cmu.edu/org/2014/08/11/Using-org-...
My scripts are a dirty combination of ideas/concepts of both of the above, that work for me depending on situation/use-case, but that I should clean up one day, and gist someplace.
I can give more info, if the above doesn't give enough pointers yet for you to dig yourself further towards "your solution".
- User23 5y agoThat’s plenty of information. Thank you!