From: Eric Schulte <schulte.eric@gmail.com>
To: Martin Gross <m-gross@gmx.net>
Cc: Michael Brand <michael.ch.brand@gmail.com>,
Org Mode <emacs-orgmode@gnu.org>
Subject: Re: sum up variables from different org-mode tables
Date: Mon, 19 Nov 2012 14:21:32 -0700 [thread overview]
Message-ID: <87vcd170gz.fsf@gmail.com> (raw)
In-Reply-To: <CAJkULmko4YdGDzHnceNe3OwSYcCky0rNMB3u3Nf+5aogDPaO9w@mail.gmail.com> (Martin Gross's message of "Mon, 19 Nov 2012 12:54:59 +0100")
[-- Attachment #1: Type: text/plain, Size: 626 bytes --]
Martin Gross <m-gross@gmx.net> writes:
> Dear Michael,
>
> thank you very much, this is what I was looking for. I myself
> supposed the answer should be related to "remote references", but was
> not sure how to use them.
>
> Just one point is not yet optimum to me: I do not have just 2 tables,
> but hundreds. It would be hard and not very clean to add them all one
> by one. Do you know if it there is a better way to reference remote
> tables?
Not a pure Org-mode solution, but something like the attached could be
used to sum up a particular column from every table in a file. Not
flexible but possibly sufficient.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: multiple-tables.org --]
[-- Type: text/x-org, Size: 343 bytes --]
#+Title: Example
* one table
| 1 | 2 |
| 2 | 4 |
| 3 | 6 |
| 4 | 8 |
| 5 | 10 |
* another table
| 20 | 20 |
* and one more
| 0 | 1 |
| 0 | 1 |
* here we sum them up
#+begin_src sh :results scalar :var file=(buffer-file-name) :var col=1
cat $file|grep "^|"|sed 's/|//g'|awk '{ sum += $1} END{ print sum }'
#+end_src
#+RESULTS:
: 35
[-- Attachment #3: Type: text/plain, Size: 298 bytes --]
> For example telling org-mode to search data from all tables but "this"
> one?
>
With a little more work and one more sed command this could stop
processing the file at a particular line or keyword.
Hope this helps,
>
> Best regards,
>
> Martin
>
--
Eric Schulte
http://cs.unm.edu/~eschulte
next prev parent reply other threads:[~2012-11-19 21:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-16 11:33 sum up variables from different org-mode tables Martin Gross
2012-11-16 15:16 ` Michael Brand
2012-11-19 11:54 ` Martin Gross
2012-11-19 13:50 ` Michael Brand
2012-11-21 17:01 ` Martin Gross
2012-11-21 18:46 ` Suvayu Ali
2012-11-19 21:21 ` Eric Schulte [this message]
2012-11-22 10:03 ` Martin Gross
2014-01-04 15:29 ` Michael Brand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87vcd170gz.fsf@gmail.com \
--to=schulte.eric@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=m-gross@gmx.net \
--cc=michael.ch.brand@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).