Sponsored Content
Full Discussion: Sort roman numerals
Top Forums Shell Programming and Scripting Sort roman numerals Post 302508445 by mirni on Monday 28th of March 2011 07:10:45 AM
Old 03-28-2011
@centurion_13: arabic() is a function defined in Roman.pm module, to convert roman number to arabic (e.g.
Code:
$a = "XLVII";
$b = arabic($a);  # b==47

That's what that Roman.pm module is made for.

$1 references what was captured in a most recent regex with parentheses.

I added comments to my original reply.
This User Gave Thanks to mirni For This Post:
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

extracting only numerals from string.

Hi!!! i have two files "tushar20090429200000.txt" and "tushar_err20090429200000.txt" The numeric part here is date and time. So this part of file keeps changing after every hour. I want to extract the numeric part from the both file names and compare them whether they are equal or not. ... (4 Replies)
Discussion started by: tushar_tus
4 Replies

2. UNIX for Dummies Questions & Answers

Using CUT command to get only numerals from a string

I need help to get only the numerals from a string Ex : var1=Nightfox has 2 red apple(s) I need to cut only the numeral 2 and move it to a variable. var2=`$var1 | cut -c 14` the cut by character doesnt work, how to get only the numeral ? (2 Replies)
Discussion started by: happyrain
2 Replies

3. UNIX for Dummies Questions & Answers

Deleting lines starting with spaces then non-numerals

I did a search but couldn't find a thread that seemed to answer this but my apologies if it has been answered before. I have some text files and I need to remove any line that does not start with a number (0-9). In actuality every line like this starts with a 'T' (or 't') but there are a... (5 Replies)
Discussion started by: skray
5 Replies

4. Shell Programming and Scripting

How to select only those file names whose name contains only numerals.

Hi Guru's, Before writing to this forum I have searched extensively on this forum about my problem. I have to write a shell script which takes out only those file names from the given directory which contains only numbers. For example, In the given directory these files are present: ... (5 Replies)
Discussion started by: spranm
5 Replies

5. Shell Programming and Scripting

Sorting with header and mixed numerals (scientific and decimal) | awk

Assoc.txt CHR SNP BP A1 TEST NMISS OR STAT P 1 rs2980319 766985 A ADD 4154 1.024 0.1623 0.8711 1 rs2980319 766985 A AGECAT 4154 1.371 6.806 1.003e-11 1 ... (6 Replies)
Discussion started by: genehunter
6 Replies

6. UNIX for Advanced & Expert Users

Script to sort the files and append the extension .sort to the sorted version of the file

Hello all - I am to this forum and fairly new in learning unix and finding some difficulty in preparing a small shell script. I am trying to make script to sort all the files given by user as input (either the exact full name of the file or say the files matching the criteria like all files... (3 Replies)
Discussion started by: pankaj80
3 Replies

7. Shell Programming and Scripting

Help with sort word and general numeric sort at the same time

Input file: 100%ABC2 3.44E-12 USA A2M%H02579 0E0 UK 100%ABC2 5.34E-8 UK 100%ABC2 3.25E-12 USA A2M%H02579 5E-45 UK Output file: 100%ABC2 3.44E-12 USA 100%ABC2 3.25E-12 USA 100%ABC2 5.34E-8 UK A2M%H02579 0E0 UK A2M%H02579 5E-45 UK Code try: sort -k1,1 -g -k2 -r input.txt... (2 Replies)
Discussion started by: perl_beginner
2 Replies

8. Shell Programming and Scripting

Sort help: How to sort collected 'file list' by date stamp :

Hi Experts, I have a filelist collected from another server , now want to sort the output using date/time stamp filed. - Filed 6, 7,8 are showing the date/time/stamp. Here is the input: #---------------------------------------------------------------------- -rw------- 1 root ... (3 Replies)
Discussion started by: rveri
3 Replies

9. Shell Programming and Scripting

[FUN] Numbers to Roman letters/num

Heyas Just a little fun script (code block) i'd like to share for fun. #/bin/bash # roman.sh # # Function # num2roman() { # NUM # Returns NUM in roman letters # input=$1 # input num output="" # Clear output string len=${#input} # Initial length to count down ... (9 Replies)
Discussion started by: sea
9 Replies
HODIE(1)							   User Manuals 							  HODIE(1)

NAME
hodie - Print current date and time... in Latin SYNOPSIS
hodie [ OPTION ]... DESCRIPTION
hodie prints out the current date using classic Latin, and in addition also prints it out and time using Roman numerals. OPTIONS
-h, --help Print short help message with syntax -v, --verbose Print months and days (pridie, Kalends, Nones, Ides) full and not the respective abbreviations (standard mode of operation) Two occurrences of -v as well as the use of -vv or --extremely-verbose will include the numerals where applicable fully declined, as in 'ante diem quintum Kalends Septembres'. -n, --numerals Don't print anything in Latin - only the date and time as Roman numerals. -x, --force-numerals Print both the verbose latin and the date and time as Roman numerals. -c, --classic, --auc Print the year in the classic manner ab urbe condita instead of the more modern anno domini . -a, --ante-diem Print the date expressing the number of days to the next main day with the ante diem expression instead of ablative case. -d, --date Print out any date. This has a rather special syntax, with a keyword following the -d flag choosing input format. See section on DATE INPUT below. -r, --republican OFFSET Print out the date dated ab urbe tua condita with the offset counted in years as compared to the modern european kalendar (originat- ing with the hypothetical birth of christ). hodie -r -753 would be equivalent with hodie -c --version Print out the version number of this release and exit. No matter whether other options appear on the command line or not. DATE INPUT
Following the -d or the --date option flags, the first item must be one of the following: verbose In this case, the year, month and day are given by following the verbose keyword by the flags -y, --year, -m, --month, -d, --day for year, month and date respectively ymd After this flag, the date comes in the format YYYY-MM-DD , where the numbers may be separated by any non-numeric character. dmy With this flag, the date is given as DD-MM-YYYY mdy With this flag, the date is given as MM-DD-YYYY Restrictions on the characters that may replace the hyphen apply as above. HISTORY
The story began on the 10. of August, 2000 (a.d. VI Id. Iul., MM). Having finished most of my assignment for my two-month summer job at Ericsson Eurolab Deutschland, Nuremberg, I was idling around on the Internet, and stumbled over the dotcomma-challenges <http://www.dot- comma.org> , where especially the Roman numeral challenge started my mind. Almost an hour hacking, and there it was, another hour, and the language support was there. Before the night was over, I had written this man page and had the layout of a decent Makefile drawn out mentally. At the end of the next day, I was so far that I actually had the workings of RPM worked out, constructed a .rpm-package and a .src.rpm- package, which was promptly released on my home-page, announced on freshmeat and uploaded to metalab (apps/misc :-). Response was quick and plentiful. By now, I have compilation reports from Linux, FreeBSD and SCO Unixware 7; there are a few compability issues to put aside, but it works surprisingly well. RETURN VALUES
hodie returns zero. Always. If it doesn't, then something is really bad with the code. For some really unreadable code, this means that hodie could be used as a strange replacement for true BUGS
It doesn't sanity check the input... telling hodie to display the roman form of the 99th of march gives a slightly jumbled output, which most definitely does not make sense. Reports are more than welcome (e-mail below). AUTHOR
Now, who would come up with such a thing? Well, I'm Mikael Johansson, a rather all-round geek from Stockholm. I'm gravely interested in languages, in computers and in mathematics; a combination more dangerous than you might think. E-mails to <mikael@johanssons.org> SEE ALSO
date(1) Linux AUGUST 2000 HODIE(1)
All times are GMT -4. The time now is 01:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy