10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi again. Sorry for all the questions — I've tried to do all this myself but I'm just not good enough yet, and the help I've received so far from bartus11 has been absolutely invaluable. Hopefully this will be the last bit of file manipulation I need to do.
I have a file which is formatted as... (4 Replies)
Discussion started by: crunchgargoyle
4 Replies
2. UNIX for Dummies Questions & Answers
Hello. Trying to add a column of numbers and combine the 1st and 2nd fields as uniq with the new total.
This works to add the numbers but can't figure an easy was to combine the 1st and 2nd column as the list is very long. awk '{s+=$3} END {print s}'
bird dog 300
bird dog 100
cat clown 200... (1 Reply)
Discussion started by: jimmyf
1 Replies
3. Shell Programming and Scripting
I have a file which has following contents which I want to add up.
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
139038.72
139038.72
139038.72
139038.72 (5 Replies)
Discussion started by: aksijain
5 Replies
4. Shell Programming and Scripting
is there another way of doing the below:
echo "7 3 8 2 2 1 3 83.4 8.2 4 8 73 90.5" | bc
shell is bash. os is linux and sunos.
bc seems to have an issue with long range of numbers (12 Replies)
Discussion started by: SkySmart
12 Replies
5. Shell Programming and Scripting
Hi
I figured how to add my list of numbers. However how do I count so that after a certain number it lists the line.
Example:
12 test1
46 test2
195 test3
174 test4
634 test5
185 test6
94 test7
So basically add the numbers and when the addition reaches 300 or less
print the... (8 Replies)
Discussion started by: bombcan
8 Replies
6. UNIX for Dummies Questions & Answers
Hi this is quite a simple question... I am new to LINUX/UNIX and so I am just trying to create a very basic program. The idea is that when the user runs the program (from the shell) they enter 3 values and the program will add them up:
"./sum 23 5 1
29"
my code for this program is as follows:
... (4 Replies)
Discussion started by: csuieb
4 Replies
7. Shell Programming and Scripting
i have a list of numbers like this;
124
235
764
782
765
451
983
909
...
and i want to make a sum with the first 3 of them then the next 3 and so on.
124+235+764=1123
782+765+451=1998
...
some ideas? (4 Replies)
Discussion started by: Tártaro
4 Replies
8. UNIX for Advanced & Expert Users
Hello, I have a file, and one column has both positive and negative numbers. Does anyone know how I can calculate the total of all the values (i.e, +ve and -ve).
eg:
col1 col2 col3
data 23 data
data 76 data
data -30 data
Thanks
Khoom (1 Reply)
Discussion started by: Khoomfire
1 Replies
9. Shell Programming and Scripting
how to add 2 float values to each other?
i tried this and it doesnt work:
#!bin/bash
numone=1.234
numtwo=0.124
total=`expr $numone + $numtwo`
echo $total
thanks (5 Replies)
Discussion started by: strike
5 Replies
10. Shell Programming and Scripting
I would like to write a script with BASH to add two numbers (integer) and write the result to the standard output. Please help! (7 Replies)
Discussion started by: Viper01
7 Replies
math::roman(1.0) math::roman(1.0)
__________________________________________________________________________________________________________________________________________________
NAME
math::roman - Tools for creating and manipulating roman numerals
SYNOPSIS
package require Tcl 8.3
package require math::roman ?1.0?
::math::roman::toroman i
::math::roman::tointeger r
::math::roman::sort list
::math::roman::expr args
_________________________________________________________________
DESCRIPTION
::math::roman is a pure-Tcl library for converting between integers and roman numerals. It also provides utility functions for sorting and
performing arithmetic on roman numerals.
This code was originally harvested from the Tcler's wiki at http://wiki.tcl.tk/1823 and as such is free for any use for any purpose. Many
thanks to the ingeneous folk who devised these clever routines and generously contributed them to the Tcl community.
While written and tested under Tcl 8.3, I expect this library will work under all 8.x versions of Tcl.
COMMANDS
::math::roman::toroman i
Convert an integer to roman numerals. The result is always in upper case. The value zero is converted to an empty string.
::math::roman::tointeger r
Convert a roman numeral into an integer.
::math::roman::sort list
Sort a list of roman numerals from smallest to largest.
::math::roman::expr args
Evaluate an expression where the operands are all roman numerals.
Of these commands both toroman and tointeger are exported for easier use. The other two are not, as they could interfer or be confused with
existing Tcl commands.
BUGS, IDEAS, FEEDBACK
This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category math ::
roman of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may
have for either package and/or documentation.
KEYWORDS
conversion, integer, roman numeral
CATEGORY
Mathematics
COPYRIGHT
Copyright (c) 2005 Kenneth Green <kenneth.green@gmail.com>
Tcl Math Library math math::roman(1.0)