From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: sum up variables from different org-mode tables Date: Mon, 19 Nov 2012 14:21:32 -0700 Message-ID: <87vcd170gz.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:33109) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TaYls-0004mI-0U for emacs-orgmode@gnu.org; Mon, 19 Nov 2012 16:20:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TaYlq-0006ec-Hm for emacs-orgmode@gnu.org; Mon, 19 Nov 2012 16:20:47 -0500 Received: from mail-ie0-f169.google.com ([209.85.223.169]:41672) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TaYlq-0006eN-8b for emacs-orgmode@gnu.org; Mon, 19 Nov 2012 16:20:46 -0500 Received: by mail-ie0-f169.google.com with SMTP id 10so9260415ied.0 for ; Mon, 19 Nov 2012 13:20:45 -0800 (PST) In-Reply-To: (Martin Gross's message of "Mon, 19 Nov 2012 12:54:59 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Martin Gross Cc: Michael Brand , Org Mode --=-=-= Content-Type: text/plain Martin Gross 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. --=-=-= Content-Type: text/x-org Content-Disposition: inline; filename=multiple-tables.org #+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 --=-=-= Content-Type: text/plain > 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 --=-=-=--