10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
I am having a difficult time getting an awk one-liner to work correctly that runs a mathematical operation upon values in a field when matching a given criteria.
I would like to subtract 1 from every value in field $6 that is greater than 12. In this particular case it is only a constant of... (3 Replies)
Discussion started by: jvoot
3 Replies
2. Shell Programming and Scripting
Hi,
I've this following text file
FileVersion = 1.03
Filetype = meteo_on_curvilinear_grid
TIME = 0 hours since 2016-10-03 12:00:00 +00:00
-6.855 -6.828 -6.801 -6.774 -6.747 -6.719 -6.691 -6.663 -6.634 -6.606 -6.577 -6.548 -6.519 -6.489
TIME = 0 hours since... (2 Replies)
Discussion started by: xisan
2 Replies
3. Shell Programming and Scripting
Hi,
I wish to compare the CPU LOAD 1 min with 5mins and 15mins.
If 1 min's CPU LOAd spike 3% compare to 5 mins or 15 mins CPU Load, it is warning.
If 1 min's CPU LOAd spike 5% compare to 5 mins or 15 mins CPU Load, it is critical.
However I received following code error, I google it and... (10 Replies)
Discussion started by: alvintiow
10 Replies
4. Shell Programming and Scripting
I am trying to run the awk below. My question is when I split the input, then run anotherawk to perform a calculation using that splitas the input there are no issues. When I try to combine them the output is not correct, is the split not working or did I do it wrong? Thank you :).
input
... (8 Replies)
Discussion started by: cmccabe
8 Replies
5. UNIX for Dummies Questions & Answers
input:
Name|Operation
rec_10|1+2+2-
Output:
rec_10|1
Basically I am trying to calculate the result of "the path" in $3 where the operators follow the number and not preceding them like we normally do:
rec_10: +1+2-2=1
But I realise (I am sure there is a good reason for that) that awk... (7 Replies)
Discussion started by: beca123456
7 Replies
6. Shell Programming and Scripting
Hi all,
I am wanting to pass variables from a file to an awk arithmetic formula.
When I use the formula with the value it works well. As soon as I make these variables I get an inf (infinity) response. I can certainly echo the variables back and they look correct. My googling for answers has... (3 Replies)
Discussion started by: gafoleyo73
3 Replies
7. Shell Programming and Scripting
Hi,
I am trying to do an addition to a value stored in a variable...
var1=`grep -n "match" sample.txt|cut -d : -f1`
var2=`echo $var1|cut -d " " -f1` (Here i want add +1 to the output value) (4 Replies)
Discussion started by: Kevin Tivoli
4 Replies
8. Shell Programming and Scripting
I am begining to learn bourne shell and as a practice I have written a script which when given the purchase price and percentage of discount calculates the savings.
I somehow cannot figure out why my script fails to do arthimatic calculation on real numbers.
Could anyone look at the script... (5 Replies)
Discussion started by: Tirmazi
5 Replies
9. Shell Programming and Scripting
I have output like following in a file
usmtnz-dinfsi19
72
71
38
1199
1199
0.8
19:23:58
usmtnz-dinfsi19
72
71
38
1199
1199
0.8
19:24:04 (9 Replies)
Discussion started by: fugitive
9 Replies
10. Shell Programming and Scripting
I have file with this type of format
01.02.09 08:30
bob
jill
mark
01.04.09 07:00
bob
jill
mark
tom
I want to count the names after the date /ime line (01.02.09 08:30) and add that number after the time like this
01.02.09 08:30 3
01.04.09 07:00 4
I don't care about... (6 Replies)
Discussion started by: marcelino
6 Replies