LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-21-2021, 12:14 PM   #1
JASlinux
Member
 
Registered: Oct 2020
Posts: 385

Rep: Reputation: Disabled
Question How do I enter command line arguments for "II" not "III"?


Using Roman Numerals to count, I've run into this conundrum. This varies by the command?
 
Old 11-21-2021, 12:41 PM   #2
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,678

Rep: Reputation: Disabled
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 View Post
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.

Last edited by shruggy; 12-03-2021 at 07:21 AM.
 
Old 11-21-2021, 12:58 PM   #3
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,455

Rep: Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353
All Unix versions use decimal numbers. Keep Roman numerals inside text files.
 
Old 12-12-2021, 07:09 AM   #4
JASlinux
Member
 
Registered: Oct 2020
Posts: 385

Original Poster
Rep: Reputation: Disabled
I can usually achieve what I seek with:

[command] [sub-string] ! [command/switch] "*[full-string]*"

example arguments:

Code:
find / -name "*II*" ! -name "*III*"
 
Old 12-12-2021, 07:37 AM   #5
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,678

Rep: Reputation: Disabled
Or use -regex
Code:
find -regex '[^I]*II[^I]*'
 
  


Reply

Tags
arguments, cli, command line, find, match, numbers, searching



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How Get "Unmodified" Command-Line Arguments? cbh2000 Programming 1 09-10-2010 08:55 PM
Unable to enter password in terminal to enter as root.. ANISHKUMAR.R Linux - Newbie 5 08-07-2010 07:46 AM
"Enter Key" not working, how to map "Enter Key" functionality to "F9" Key srinihi Linux - Newbie 1 04-03-2009 02:46 PM
How can I enter php interface like "python[enter]" in python backpacker Linux - Software 1 06-20-2005 07:38 PM
"Disk boot failure. Enter system disk and press enter" Fear58 Linux - Hardware 3 06-25-2004 05:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration