site  contact  subhomenews

align perl utility updated

August 26, 2021 — BarryK

For the previous post, I had a list of 807 packages and wanted to process them into neat columns. EasyOS has the 'column' utility, but I couldn't make it do what I want, so wrote a little script to convert the package names into a html table. For the record this is it:

#!/bin/sh
echo '<html>
<table>' > pkg-list-table
CNT=0
for W in `cat pkg-list`
do
case "$W" in
packagegroup*) continue ;;
esac
[ $CNT -eq 0 ] && echo '<tr>' >> pkg-list-table
echo " <td>${W}</td>" >> pkg-list-table
CNT=$(($CNT+1))
[ $CNT -lt 10 ] && continue
echo '</tr>' >> pkg-list-table
CNT=0
done
echo '</table>
</html>' >> pkg-list-table

...pretty simple.

Before implementing the html table solution, I tried to use 'align'. This is a perl script, also in EasyOS, however, found that it doesn't work, the script 'getopts.pl' is required. However, that script is no longer in perl.

align is created by Steve Kinzler, and I looked at the project page:

http://kinzler.com/me/align/

Ah ha, there is a later version! I have 1.7.1, and 1.7.5 is available. Although it is possible to obtain that old 'getopts.pl', version 1.7.5 doesn't require it, and it works in EasyOS -- at least, the "--help" works!

I have made it into a PET, which will be uploaded here soon:

http://distro.ibiblio.org/easyos/noarch/packages/pet/pet_packages-noarch/

I haven't actually used it, as already have implemented the html table. align has been in EasyOS and in puppies before that, and no one ever complained to me about it, so perhaps no one has used it. Most likely, because no one knew it was there.   

Tags: easy