9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi, I need to run a Fortran program which reads a input file with a fixed name many times, each time I need to change a number (real) in that input file, this is how I currently do it and I know it is not elegent at all:
cp inputfile.dat backup.dat
sed -i 's/28.0/0.01/g' inputfile.dat
./myCode... (3 Replies)
Discussion started by: dypang
3 Replies
2. Shell Programming and Scripting
I am using bash
I have a script that takes a number, i.e. 85.152, which is always a non integer and essentially tries to get that number to be a multiple of 10. My code is as follows:
number=85.152
A=${number%.*} #Converts float to integer
typeset -i B=$(((A-20)/10)) #subtracting 20 is... (12 Replies)
Discussion started by: prodigious8
12 Replies
3. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
Write a shell script that will take the sum of two random number?
Ex: Random n1 +Random n2 = result
i tries to write it but i had some dufficulties
... (3 Replies)
Discussion started by: renegade755
3 Replies
4. Shell Programming and Scripting
Hi,
I am having trouble with generating random numbers. can this be done with awk?
So I have a file that looks like this:
23 30
24 40
26 34
So column1 is start and column2 is end. I want to generate 3 random #'s between start and stop:
So the output will look like this:
... (9 Replies)
Discussion started by: phil_heath
9 Replies
5. Programming
Hi, i have a simple control like this:
if(sum>1.0)...
If i try to print sum i get 1.000000 but the check returns true. I think it depends on float precision. How can i modify the check?
thanks (1 Reply)
Discussion started by: littleboyblu
1 Replies
6. Shell Programming and Scripting
Hello All,
I want to make a simple script which generate random number from 0 to 1000.
and simply display it.
Plz HELP!!!!!!
Regards,
Waqas Ahmed (2 Replies)
Discussion started by: wakhan
2 Replies
7. Solaris
Hi all,
I have doubt can array in a shell script can store floating point numbers. i have tired. but i unable to work it out.
Please help me regarding this
Thank U
Naree (1 Reply)
Discussion started by: naree
1 Replies
8. Solaris
total=0
declare -a sum
limit=`iostat -En | grep -i size | awk '{print $2}' | sed -e 's/GB//g' | wc -l`
echo "Limit is equal to $limit"
ara="`iostat -En | grep -i size | awk '{print $2}' | sed -e 's/GB//g'`"
for (( i=1; i<=$limit; i++ ))
do
sum=`echo $ara | cut -d " " -f $i`
echo ${sum}... (11 Replies)
Discussion started by: naree
11 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