9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all,
I have one host i need to run in loop to check the capacity from different frame and get the output to one file and sum it and convert to TB
this is Code
#!/bin/ksh
DATE=`date '+%d%m%y'`
for f in `cat /home/esx-capacity/esx-host.txt`
do
for g in `cat /home/esx-capacity/frame`... (10 Replies)
Discussion started by: ranjancom2000
10 Replies
2. Post Here to Contact Site Administrators and Moderators
i want code in awk with loop to get the sum
* is delimiter in file
TOTAL_AMOUNT=SUM(CLP04)
suppose there are 12 CLP04 segment in my file i want to add upto 5 CLP04 then print next line after BPR segment after calculate the total amount
CLP04 means
ex
... (5 Replies)
Discussion started by: MOHANP12
5 Replies
3. Shell Programming and Scripting
Hi
i have to calculate some numbers, column by column.
Herfore i used a for-loop..
for i in {4..26};do awk -F"," '{x'$i'+=$'$i'}END{print '$i'"\t" x'$i'}' file.tmp;done
----- printout -----
4 660905240
5 71205272
6 8.26169e+07
7 8.85961e+07
8 8.60936e+07
9 7.42238e+07
10 5.6051e+07... (7 Replies)
Discussion started by: IMPe
7 Replies
4. Shell Programming and Scripting
Hi All,
I got stuck up with shell script where i use awk. The scenario which i am working on is as below.
I have a file text.txt with contents
COL1 COL2 COL3 COL4
1 A 500 200
1 B 500 300
2 A 290 150
2 B 290 140
3 C 100 100
I could able to sum col 3 and col4 based on col1 using... (1 Reply)
Discussion started by: imsularif
1 Replies
5. Shell Programming and Scripting
Hi,
I have a hash which is to be populated by reading data lines from a flat file. I am supposed to read fields 1-5 from the file and load them on to the hash such that fields 1-4 are going to be the hash key-set and field 5 is the hash value.
Field 5 is a monetary amount and is supposed... (1 Reply)
Discussion started by: sinpeak
1 Replies
6. Shell Programming and Scripting
Hi,
I am unable sum of each column in the loop usng awk command.
Awk is not allowing the parameters in the command.
i am facing the below error.
awk: 0602-562 Field $() is not correct.
Source file
abc.txt
100,200,300,400,500,600,700,800,900
101,201,301,401,501,601,701,801,901
... (1 Reply)
Discussion started by: number10
1 Replies
7. Shell Programming and Scripting
Hi All,
I have a file abc.txt with 3 fileds. Field 3 contains amount. Also at the end of file there is a Footer record, which contains total amount.
I need to calculate total sum of these fields & need to compare it with footer record. I have serched in thi site, many has asked this... (7 Replies)
Discussion started by: Amit.Sagpariya
7 Replies
8. Shell Programming and Scripting
Hi,
I am trying to extracting the sum of all varibles listed in a file.
The code is as follows
##### FILE1 ########
Value1:2
Value2:2
Value3:6
Value4:5
##### shell script ######
#!/bin/sh
total=0 (2 Replies)
Discussion started by: eagercyber
2 Replies
9. UNIX for Dummies Questions & Answers
Hello everyone!!
I have to write a script in unix that reads a file which is in the format:
1%blabla%30
2%blabla2%50
1%blabla3%40
2%blabla4%10
and produce the total quantities of 1 and 2: "1 = 70 2 = 60"
I am taught basic unix commands, so I must keep it simple, how can i do this using... (7 Replies)
Discussion started by: questionmaker25
7 Replies