[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] A poor mans Excel
From: |
Ulrich Lauther |
Subject: |
[groff] A poor mans Excel |
Date: |
Thu, 10 Oct 2019 13:21:31 +0200 |
User-agent: |
Mutt/1.9.4 (2018-02-28) |
Hi all,
I have written a small perlscript, that preprocesses tables
and allows to
- add the values in selected collums
- to replace a table entry by the result of an expression
Lines between
.(
and
.)
are processed.
The ".(" line may contain the numbers of collums in which addition
is requested, e.g.:
.( add 2 5 7
or just
.( 2 5 7
".(" ".)" blocks my be nested; sums calculated at a lower level are
propagated up.
Table entries of the form E.<n> <expression> are repaced by the result
of the expression rounded to n digits after the decimal point.
"expression" is any valid perl expression.
Variables used in the expression are
- any valid perl variable (starting with "$")
- $<n>, the value in column n in the current line
- $S, sum of values in the column (where $S is placed) seen so far
If $S or E.<n> is precedet by an "!", addition is suppressed for this
table entry.
As all tables of a document are processed by one perl-instance and perl
variables can be created on the fly, values can be tranported from one
table line to a later one or even to another table.
Code size: 130 lines of perl
Limitations: Multiline table enties are not supported.
If there is interest, I'll post the script and an example.
Kind regards,
ulrich lauther
- [groff] A poor mans Excel,
Ulrich Lauther <=