10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
a=1 456
b=4928
c=23
d=456
I want to compare four variables to get the name of the variable having the highest number (2 Replies)
Discussion started by: proactiveaditya
2 Replies
2. 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
3. Shell Programming and Scripting
Hello,
I have a case where I need to process an environment variable text value in CShell to calculate the product of 2 numbers stated in the variable string having the format "<first_number>Letter x<second_number>".
Ex: $VAR = "24x20"
I need to set $VAR_PRODUCT = "Product of 20 and 24"... (3 Replies)
Discussion started by: mohy
3 Replies
4. Shell Programming and Scripting
if i want to display the contents of a file between say line number 3 and 10 then i use the following command
sed -n '3,10p' filename
if this 3 was contained in x and 10 was contained in y then how wud this command modified?
sed -n '$x,$yp' filename does not work..please advise (2 Replies)
Discussion started by: arindamlive
2 Replies
5. Shell Programming and Scripting
It seems that perl sprintf uses the round-to-even method:
foreach my $i ( 0.5, 1.5, 2.5, 3.5 ) {
printf "$i -> %.0f\n", $i;
}
__END__
0.5 -> 0
1.5 -> 2
2.5 -> 2
3.5 -> 4
4.5 -> 4
Where we probably wants to use round-half-up, i.e. output should be as below:
0.5 -> 1
1.5 -> 2... (8 Replies)
Discussion started by: ganapati
8 Replies
6. Shell Programming and Scripting
Hi everyone, I am having some problems with my scripts so I hope you could help me.
I am trying to store the result of a division in a variable in tcshell but I have the problem that if:
For example, dividing 2/100 the result is 0.02 but if I store that I have "0".
How can I have 0.02... (8 Replies)
Discussion started by: Bloody
8 Replies
7. Shell Programming and Scripting
Dear pal,
I want to read only numbers thru a shell script,
If user is trying to enter character it should block that ...
Pls help to me find out a solution (2 Replies)
Discussion started by: bhagyaraj.p
2 Replies
8. Shell Programming and Scripting
I wish to give line number from one point to another in sed command like this
sed -n 1,1000000p file1.txt >file2.txt
but variable line number $x,$x+100000 can i give it cos i tried and it was giving an error any suggestions?/
Thx in advance
AC (2 Replies)
Discussion started by: bezudar
2 Replies
9. Shell Programming and Scripting
Hi All,
Is it possible in Unix shell script to extract numbers from a string containing ".", such as;
5.2.314
And store in variables so;
var1 = 5
var2 = 2
var3 = 314
Thanks in advance for any help anyone can provide
dave (6 Replies)
Discussion started by: davewg
6 Replies
10. Shell Programming and Scripting
cat dailyreports | grep "Important list" | awk -F":" '{print $2}' | awk -F" " '{print $1}'
hey guys, after running the above combination of cat and awk, i get the below output:
3
4
2
9
now, i need to add these numbers up all in one line. i dont know what to add to that cat and awk one... (2 Replies)
Discussion started by: Terrible
2 Replies