weasyprint
— это альтернатива, упакованная в Debian bullseye/sid , ее можно установить в предыдущей версии Debian через pip
. требуется Python 3.5+:
pip install weasyprint
В Bash вы можете использоватьmapfile
(его следует протестировать с вашим фактическим результатом):
# note that the parenthesis are not needed
$ result="HOUSE CAR
DOC CAT"
$ mapfile -t arr < <(printf "%s" "$result")
$ echo "${arr[0]}" # or 1 if the first row is empty
HOUSE CAR