Sponsored Content
Top Forums Shell Programming and Scripting need help converting string to number for calculation Post 302114241 by tpatput on Friday 13th of April 2007 10:40:23 AM
Old 04-13-2007
anbu23, shell_life, thanks so much for your quick responses. You've really helped and it is very much appreciated.

Tom
 

10 More Discussions You Might Find Interesting

1. Programming

converting character string to hex string

HI Hi I have a character string which contains some special characters and I need it to display as a hex string. For example, the sample i/p string: ×¥ïA Å gïÛý and the o/p should be : D7A5EF4100C5010067EFDBFD Any pointers or sample code pls. (5 Replies)
Discussion started by: axes
5 Replies

2. Shell Programming and Scripting

Converting Stirngs to number

I have written a script to compare the values of string (which actually are numbers) but it is not giving the expected output. Please suggest for the script. #!/usr/bin/ksh sysdate=20071009 echo $sysdate currfile=20071008 echo $currfile if ; then echo "Equal" else echo "Not... (2 Replies)
Discussion started by: raman1605
2 Replies

3. Shell Programming and Scripting

Help needed in converting number to bit

Hi, I have the following file input:- 542 4795 61 543 4795 61 544 0 0 545 292 ... (5 Replies)
Discussion started by: ahjiefreak
5 Replies

4. Shell Programming and Scripting

Problem in converting number in shell script

Hi All, I am writing a shell script in which I want to convert a number like : Suppose the number is "98487657" and we have to convert it to "98000000", what I want to do is to retain first 2 digits and convert all remaining digits to "0". Number could be of any length (length... (4 Replies)
Discussion started by: amitanshu.verma
4 Replies

5. Shell Programming and Scripting

Average calculation based on number of rows

Dear users, I need your support, I have a file like this: 272134.548 6680572.715 272134.545 6680572.711 272134.546 6680572.713 272134.548 6680572.706 272134.545 6680572.721 272134.543 6680572.710 272134.544 6680572.715 272134.543 6680572.705 272134.540 6680572.720 272134.544... (10 Replies)
Discussion started by: Gery
10 Replies

6. Shell Programming and Scripting

Performing a calculation on string to be replaced

Hi, I have a file with occurances of the string "TO_DATE(<number here>,'J')" at random places. I need minus 2400000 from the number and replace the string with "convert(date, dateadd(dd, <new number here>,'16 Nov 1858')". I'm finding this difficult as the string isn't necessarily in the... (9 Replies)
Discussion started by: user_invalid
9 Replies

7. Shell Programming and Scripting

KSH SHELL: problem calculation number of lines inside compressed file

Hi Gurus, I am working with a korn shell script to simplify some operations of calculation number of lines inside compressed file. The called function (inside a cycle) is the following: ######################################### # F.ne: CheckCount #########################################... (3 Replies)
Discussion started by: GERMANICO
3 Replies

8. UNIX for Dummies Questions & Answers

converting string to number in shell script

Hi, I am having a problem in converting a string to number so I can preform arithmetic operations. timeTot=0 timeTmp=$(cat idsOutput | grep 'Run time' | cut -c 36-39) timeTot=$ #This is line 28 echo "total RunTime=" $timeTot this is the error msg: ./ids2.sh: line 28: 0+1.35: syntax... (8 Replies)
Discussion started by: turki_00
8 Replies

9. Shell Programming and Scripting

Decimal number calculation problem

I have a below snippet of code from my perl script and its causing a problem when the output of $lTAX is 0 (zero) its getting displayed as -0.00. I want output to be 0 not -0.00. Any help would be appreciated. #!/usr/bin/perl my $lTotA = 50.94; my $lVatA = 8.49; my $lAllocD; my $lAdjNr =... (4 Replies)
Discussion started by: Devesh5683
4 Replies

10. UNIX for Beginners Questions & Answers

Converting negative number to positive in a file

Hi ALL, I am having semi column separated file as below. I am having negative values for the records starting with 11095. How can I convert that positive number I tried this below seems not working sed 's/ \(*\)$/ -\1/;t;s/\(.*\)-/\1/ myfile myfile... (6 Replies)
Discussion started by: arunkumar_mca
6 Replies
IPSEC_RANBITS(8)						  [FIXME: manual]						  IPSEC_RANBITS(8)

NAME
ipsec_ranbits - generate random bits in ASCII form SYNOPSIS
ipsec ranbits [--quick] [--continuous] [--bytes] nbits DESCRIPTION
Ranbits obtains nbits (rounded up to the nearest byte) high-quality random bits from random(4), and emits them on standard output as an ASCII string. The default output format is datatot(3) h format: lowercase hexadecimal with a 0x prefix and an underscore every 32 bits. The --quick option produces quick-and-dirty random bits: instead of using the high-quality random bits from /dev/random, which may take some time to supply the necessary bits if nbits is large, ranbits uses /dev/urandom, which yields prompt results but lower-quality randomness. The --continuous option uses datatot(3) x output format, like h but without the underscores. The --bytes option causes nbits to be interpreted as a byte count rather than a bit count. FILES
/dev/random, /dev/urandom SEE ALSO
ipsec_datatot(3), random(4) HISTORY
Written for the Linux FreeS/WAN project <http://www.freeswan.org> by Henry Spencer. BUGS
There is an internal limit on nbits, currently 20000. Without --quick, ranbits's run time is difficult to predict. A request for a large number of bits, at a time when the system's entropy pool is low on randomness, may take quite a while to satisfy. Though not a bug of ranbits, the direct use of /dev/hw_random, the Linux hardware random number generator is not supported because it can produce very non-random data. To properly use /dev/hw_random, the rngd daemon should be used to read from /dev/hw_random and write to /dev/random, while performing a FIPS test on the hardware random read. No changes to Openswan are required for this support - just a running rngd. [FIXME: source] 10/06/2010 IPSEC_RANBITS(8)
All times are GMT -4. The time now is 04:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy