02-07-2008
Shortening Numbers
Hi,
I'm using ksh and I'm trying to shorten a column of figures. For example, I'd like to turn:
3456789.9876 to 89.98
567.4956 to 67.49
4669493932.34564 to 32.34
... so the input figure will vary in length, I'm not worried about rounding, I just want the two figures either side of the dp. I probably know how to do it in awk and cut etc I just wondered if there was a more elegant way using say a number format in something like printf.
So far I haven't found a number format that will exclude figures starting from the extreme left (the millions, 100,000s etc). Anyone?
Last edited by Jonny2Vests; 02-07-2008 at 02:49 PM..
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I have two files one (numbers file)contains the numbers(approximately 30000) and the other file(record file) contains the records(approximately 40000)which may or may not contain the numbers from that file.
I want to seperate the records which has the field 1=(any of the number from numbers... (15 Replies)
Discussion started by: Shiv@jad
15 Replies
2. Shell Programming and Scripting
Howdy experts,
We have some ranges of number which belongs to particual group as below.
GroupNo StartRange EndRange
Group0125 935300 935399
Group2006 935400 935476
937430 937459
Group0324 935477 935549
... (6 Replies)
Discussion started by: thepurple
6 Replies
3. UNIX for Dummies Questions & Answers
hey,
I have a file with numbers in US notation (1,000,000.00) as well as european notation (1.000.000,00)
i want all the numbers to be in european notation.
the numbers are in a text file, so to prevent that the regex also changes the commas in a sentence/text i thought of:
sed 's/,/\./'... (2 Replies)
Discussion started by: FOBoy
2 Replies
4. Shell Programming and Scripting
As it was a new topic i started a new thread.
There are different Directories under "$HOME/rsh/Desktop/at/bin/bellhop/ and $HOME/rsh/Desktop/at/examples/"
i want to perform some operation like cp or mv
Is it possible to do
R=$HOME/rsh/Desktop/at/bin/bellhop/... (1 Reply)
Discussion started by: shashi792
1 Replies
5. Shell Programming and Scripting
Hello All,
I am having problem to find what is the smallest number from 90% of highest numbers from all numbers in file. I am having file with thousands of lines and hundreds of columns.
I am familiar mainly with bash but I am open to whatever suggestion witch will lead to the solutions.
If I... (11 Replies)
Discussion started by: Apfik
11 Replies
6. UNIX for Dummies Questions & Answers
##### (0 Replies)
Discussion started by: lucasvs
0 Replies
7. Shell Programming and Scripting
there was a post previously about this from around 2010
but i was unable to get the suggested scripts there to work.
the following code works for me when it's saved inside the
directory of files whose names i want to shorten, but i would
like to be able to store it in a file with a list of ... (4 Replies)
Discussion started by: giseismology
4 Replies
8. Shell Programming and Scripting
The purpose of the below is to grab the 9th field of the data in "$epochtimeframe". and then translate that data (which is an epoch time), into a human readable form.
echo $epochtimeframe | awk -F"--" '{print $9}' | awk -F"," '{print $2}' | perl -pe 's/(\d+)/localtime($1)/e'
i'm sure many... (10 Replies)
Discussion started by: SkySmart
10 Replies
9. 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
10. UNIX for Beginners Questions & Answers
Hi!
I found and then adapt the code for my pipeline...
awk -F"," -vOFS="," '{printf "%0.2f %0.f\n",$2,$4}' xxx > yyy
I add -F"," -vOFS="," (for input and output as csv file) and I change the columns and the number of decimal...
It works but I have also some problems... here my columns
... (7 Replies)
Discussion started by: echo manolis
7 Replies
LEARN ABOUT DEBIAN
searchrdsfig
SEARCHRDSFIG(3) RDS PHYSICAL FUNCTIONS SEARCHRDSFIG(3)
NAME
searchrdsfig - searchs by name a figure in the list of figures
ORIGIN
This software belongs to the ALLIANCE CAD SYSTEM developed by the ASIM team at LIP6 laboratory of Universite Pierre et Marie CURIE, in
Paris, France.
Web : http://asim.lip6.fr/recherche/alliance/
E-mail : alliance-users@asim.lip6.fr
SYNOPSYS
#include "rutnnn.h"
rdsfig_list *searchrdsfig( Name )
char *Name;
PARAMETER
Name Name of the figure to search.
DESCRIPTION
The searchrdsfig function searchs a figure by its name in the list of figures in memory.
RETURN VALUE
Pointer to the figure searched. If the figure is not found then pointer NULL is returned.
ERRORS
none
EXAMPLE
#include "mutnnn.h"
#include "rdsnnn.h"
#include "rutnnn.h"
#include "rtlnnn.h"
main()
{
rdsfig_list *Figure;
rdsfig_list *ScanFigure;
mbkenv();
rdsenv();
loadrdsparam();
Figure = addrdsfig("na2",0);
Figure = addrdsfig("no2",0);
Figure = addrdsfig("xr2",0);
Figure = addrdsfig("n03",0);
ScanFigure = searchrdsfig("xr2");
viewrdsfig ( ScanFigure );
}
SEE ALSO
librtl, librds
BUG REPORT
This tool is under development at the ASIM department of the LIP6 laboratory.
We need your feedback to improve documentation and tools.
ASIM
/LIP6 October 1, 1997 SEARCHRDSFIG(3)