This doesn't answer the question because AFAIK there is no simple way to achieve the goal exactly like OP requests. Instead I show two different approaches to achieve the goal as best as possible.
As far as I know, the only easily accessible interface between a shell script and tables in GUI office software like LibreOffice is .csv
–
a comma-separated values file
This is very simple, but also very basic and doesn't allow for any formatting. Here's a usage example:
$ echo -e "heading 01,heading 02\ncell A2,cell B2\ncell A3,cell B3" >a.csv
$ loffice -o a.csv

As a .csv
is a simple text file, you can change the content with every editor, let's use sed
:
$ sed -i 's/cell A2/replaced cell/' a.csv
$ loffice -o a.csv

As stated above, this doesn't allow for any formatting besides all caps, which in your context is not very satisfactory.
If you on the one hand want to have simple text files you can easily change with command-line tools, but on the other hand also want to get a beautifully formatted document,
LaTeX is for you
I'd create a template.tex
and mark the lines I'd like to change later with comments LaTeX ignores, e.g. cell coordinates like %A2
:
\documentclass{scrartcl}
\usepackage{booktabs}
\usepackage{multicol}
\begin{document}
\begin{tabular}{p{5cm}p{5cm}}
\toprule
\multicolumn{2}{l}{System/Client Information} \\
\midrule
{\tiny Machine Hostname:}\newline
dessert's plowhorse %A2
&
{\tiny Machine Brand and Model:}\newline
Thinkpad X240 %B2
\\
{\tiny Operating System (Version \& Variant):}\newline
Lubuntu 16.04.3 LTS %A3
&
{\tiny Kernel Version\,/\,Update Level:}\newline
4.10.0-35-generic %B3
\\
\bottomrule
\end{tabular}
\end{document}
Compiled this looks like:

At the beginning of your script you just create a unique output filename and copy the template:
outfile="/path/to/$(date +%F_%T).tex"
cp /path/to/template.tex "$outfile"
Now you can change this file and adapt it to your needs with sed -i
, thanks to the line marks added in comments it's easy to select single cells:
sed -i 's/.*%A2/ replaced cell value/' "$outfile"
When all changes are done just run pdflatex
on the .tex
file to get the .pdf
output:
pdflatex "$outfile"

Some links to get started with LaTeX
- Installation:
- Get started:
- Find answers: