Sponsored Content
Full Discussion: For Loop & SUM
Top Forums Shell Programming and Scripting For Loop & SUM Post 302766877 by Daniel Gate on Tuesday 5th of February 2013 05:48:45 PM
Old 02-05-2013
That works perfect! Appreciate it!
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

write a script & sum contents!PLEASE HELP

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

2. Shell Programming and Scripting

While loop - The sum seems to be local

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

3. Shell Programming and Scripting

Sum values & compare with footer

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

4. Shell Programming and Scripting

loop + sum + print using awk

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

5. Shell Programming and Scripting

PERL : Group & Sum in hash

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

Help with Associative array to sum & Average

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

7. Shell Programming and Scripting

Sum up numbers in a for loop

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

8. Post Here to Contact Site Administrators and Moderators

awk to sum in Loop

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

9. Shell Programming and Scripting

Need help the sum from loop

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
RLFE(1) 						      General Commands Manual							   RLFE(1)

NAME
rlfe - "cook" input lines for other programs using readline SYNOPSIS
rlfe [-l filename] [-a] [-n appname] [-hv] [command [arguments ...]] DESCRIPTION
rlfe lets you use history and line-editing in any text oriented tool. This is especially useful with third-party proprietary tools that cannot be distributed linked against readline. It is not perfect but it works pretty well. OPTIONS
-a append to the logfile (default is to overwrite). -l filename log into file. -n appname set the readline application name. -h print usage string. -v print version information. SEE ALSO
readline(3) AUTHOR
Per Bothner PROBLEMS
/TODO When running mc -c under the Linux console, mc does not recognize mouse clicks, which mc does when not running under fep. Pasting selected text containing tabs is like hitting the tab character, which invokes readline completion. We don't want this. I don't know if this is fixable without integrating fep into a terminal emulator. Echo suppression is a kludge, but can only be avoided with better kernel support: We need a tty mode to disable "real" echoing, while still letting the inferior think its tty driver to doing echoing. Stevens's book claims SCR$ and BSD4.3+ have TIOCREMOTE. The latest readline may have some hooks we can use to avoid having to back up the prompt. Desirable readline feature: When in cooked no-echo mode (e.g. password), echo characters are they are types with '*', but remove them when done. A synchronous output while we're editing an input line should be inserted in the output view.PPbefore* the input line, so that the lines being edited (with the prompt) float at the end of the input. A "page mode" option to emulate more/less behavior: At each page of output, pause for a user command. This required parsing the output to keep track of line lengths. It also requires remembering the output, if we want an option to scroll back, which suggests that this should be integrated with a terminal emulator like xterm. RLFE(1)
All times are GMT -4. The time now is 01:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy