What command? I don't know any command that requires Roman numerals.
If your problem is converting between Roman and Arabic numerals, consider using
Perl or
Python. For quick conversion on the command line, install
Qalculate!
Code:
$ qalc -t 1984 to roman
MCMLXXXIV
$ qalc -t 'roman(dcxliv)'
644
The command line version of
Qalculate! is in package
qalculate on Fedora-based distros, openSUSE, Mageia, and ALT;
qalc on Debian-based distros and OpenMandriva;
libqalculate on Arch, Gentoo, Slackware and PCLinuxOS.
Formatting plain text with Roman numerals can be done e.g. in
groff
Code:
$ cat Roman.roff
.pl 0
.nr r 0 1
.af r I
Chapter \n+r
Chapter \n+r
Chapter \n+r
Chapter \n+r
$ nroff Roman.roff
Chapter I
Chapter II
Chapter III
Chapter IV
Quote:
Originally Posted by JASlinux
Using Roman Numerals to count
|
How are you using them to count?
Perl?
Python? roff like above? sed like below?
Code:
sed -z -e '
x
s/$/I/
s/IIIII/V/g
s/VV/X/g
x;G
s/VIIII$/IX/
s/IIII$/IV/
s/\c@//' -e 39q /dev/zero|tr \\0 \\n
This will correctly count only till 39. To count further, the already unwieldy sed expression will have to grow even more.
If you want to do something more fancy,
Linux Journal once ran a series of
two articles showing how to convert Roman numerals with a Bash script.
Rosetta Code has
a couple of pages on Roman numerals conversion as well. And
Awesome Open Source lists
a bunch of GitHub projects related to Roman numerals.
Add to that
this old thread here on LQ.