Hi MadeInGermany...
The problem is it rounds both down and up; and int() function rounds down only...
EDIT:
Apologies; ignore, I misread the OP's requirements...
Last edited by wisecracker; 04-22-2020 at 02:01 PM..
Reason: see EDIT:
i want to convert from an integer to a string..in unix...i am writing a C program with embedded SQL...
I remeber using itoa...but for some reason it doesnt work......i cant find it in the manual.....
Maybe that is the wrong command.....
but i have checked Dev Studio.....and it doest exist in the... (6 Replies)
Hi,
I am trying to write a script to extract multiple sets of data from a chemistry output file. The problem section is in the following format...
Geometry "geometry" -> "geometry"
1 Pd 46.0000 -0.19290971 0.00535260 0.02297606
2 P ... (7 Replies)
Hiii
I actually intent to check the integer or floating point number input by user i.e. 23, 100, 55.25, 12.50 ..etc. However, when someone input strings or alpha character, my program has to show invalid input.!! Is there any Unix shell script syntax can help me to check ?
Thanking you (2 Replies)
Hi !
I'm looking for a way to transform certain floating point numbers in a one-line, variable length file to integers.
I can do this in a crude way with sed :
sed -e 's/0\.\(\):/\1:/g' -e 's/0\.0\(\):/\1:/g' -e 's/1\.000:/100:/g' myfile ... but this doesn't handle the rounding correctly.
... (3 Replies)
Hi !
How to increment a varibale in ksh.
#!/bin/ksh
set -x
RELEASE_NUM=5.2.103
VAL=0.0.1
RELEASE_NUM=`echo $RELEASE_NUM + $VAL | bc`
echo $RELEASE_NUM
The above code is throwing this error.
+ RELEASE_NUM=5.2.103 (2 Replies)
Hi fellows!!
i'm doing something which is not working out for me properly which i don't understand why
nowdate=`date +%s`
echo $nowdate
now the problem how to convert a date which is stored in a variable
mydate="22/Oct/2011"
mydate=`date -d '$mydate' +%s`
it gives error... (11 Replies)
I am running some commands and I am trying to get an output into a variable. I am having problem when I try to put that value in while loop, it says integer value expected. What's the best way to accomplish this
remaining=$(symclone -sid XXX -f Clone_test query | grep MB | awk '{print... (1 Reply)
Using below command
awk 'NR==FNR{A=$1;next}
{sum+=($2*A)}END{OFMT="%20f";print int(sum)}' Market.txt Product.txt
answer:351770174.00000
how to convert this to 351770174.
when i try with below command i am getting different result.
awk 'NR==FNR{A=$1;next}... (3 Replies)
I have a document that has 7 columns.
eg.
$1 $2 $3 $4 $5 $6 $7
string string string string integer integer integer
The 6th and 7th columns are a mix of integers and floating decimals (with 4 decimal places). I need to convert the last 2 columns so that all... (3 Replies)
Hello Guys,
I have a floating point number 1.14475E+15 I want to convert this number in to full number (Integer or Big integer). I tried couple of functions it did not work. When I use INT=${FLOAT/.*} I am getting value as 1. I don't want a truncated value
#!/bin/bash
#... (9 Replies)