how to add up a total in a summary report?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to add up a total in a summary report?
# 8  
Old 04-22-2009
ya that part of the error message i get
# 9  
Old 04-22-2009

Then read the error message (it tells you what the problem is) and fix the cause of it.

# 10  
Old 04-23-2009
ya that what i have been doing for the past few nights and i cant seems to solve the problem..
# 11  
Old 04-23-2009
The only question I have is where count is set in print_gtotal() for you to increment. There's a lot going on so it's a bit hard to follow.

Code:
print_gtotal()
{
  gtotal=0
  grep -i : $POS | while read x
    do
        temp1=`echo $x | cut -d: -f2 | cut -c2-`
        temp2=`echo $x | cut -d: -f3`
        temp3=`calcu_m $temp1 $temp2`
                gtotal=`calcu_a $gtotal $temp3`
        n=`num_lines "$i"`
           if [ "${n}" -eq "${count}" ]; then
            echo  "Grand Total      $"$gtotal
          fi
        count=`expr $count + 1`
    done 

}

# 12  
Old 04-23-2009
Quote:
Originally Posted by xiaojesus
ya that what i have been doing for the past few nights and i cant seems to solve the problem..

The offending line is:

Code:
print_dtotal | sort -f4| while read z

The error message is:

Code:
sort: invalid option -- 4

HINT: Remove the invalid option
# 13  
Old 04-23-2009
Quote:
Originally Posted by giannicello
The only question I have is where count is set in print_gtotal() for you to increment. There's a lot going on so it's a bit hard to follow.

Code:
print_gtotal()
{
  gtotal=0
  grep -i : $POS | while read x
    do
        temp1=`echo $x | cut -d: -f2 | cut -c2-`
        temp2=`echo $x | cut -d: -f3`
        temp3=`calcu_m $temp1 $temp2`
                gtotal=`calcu_a $gtotal $temp3`
        n=`num_lines "$i"`
           if [ "${n}" -eq "${count}" ]; then
            echo  "Grand Total      $"$gtotal
          fi
        count=`expr $count + 1`
    done 
 
}


hmm so i shld take out the count?

but b4 i can print the grand total, i need to print out the daily sales. and my daily sales cant be printed out also
# 14  
Old 04-23-2009
Quote:
Originally Posted by cfajohnson
The offending line is:

Code:
print_dtotal | sort -f4| while read z

The error message is:

Code:
sort: invalid option -- 4

HINT: Remove the invalid option
okie i shld try that tonite
Login or Register to Ask a Question

Previous Thread | Next Thread

5 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Generate a Summary report

Hi All, Script to meet my requirement might be simpler for UINIX experts.. :) I need to generate an summary report in .txt file using shell script I have Reject directory in Unix server which contains all reject files for three diff categories- Presentation, Chapter and Scene Following... (3 Replies)
Discussion started by: Sakthikalluri
3 Replies

2. Shell Programming and Scripting

Summary report csv file

Hello, I have 2 csv files with 4 columns each. file1.csv A, AA, AAA, AAAA B, BB, BBB, BBBB file2.csv C, CC, CCC, CCCC D, DD, DDD, DDDD I would like to use shell commands (sed, awk...) to copy the content of the 2 files (2x4 columns) into a final csv template file. Expected... (2 Replies)
Discussion started by: inMyZone35
2 Replies

3. Linux

How to calculate total CPU usage from SAR report?

Hi, I want to calculate the total cpu usage from the sar report. Say for example, Linux 2.6.24-21-generic (blade10) 09/10/2012 04:54:36 PM CPU %user %nice %system %iowait %steal %idle 04:54:37 PM all 0.00 0.00 0.00 0.00 ... (1 Reply)
Discussion started by: rohitmd
1 Replies

4. Shell Programming and Scripting

Parse diff output into very detailed & summary report

Hello all; I'll try an explain my dilemma as best I can. But first some background: 1- I am suppose to compare a database to itself before and after changes; basically generate audit trail report. 2- This database contains "RULES" (the id field) that we use for transmitting files. 3 - The... (0 Replies)
Discussion started by: gvolpini
0 Replies

5. UNIX for Dummies Questions & Answers

Print summary or the total disk usage of conf file

hey i want to print the summary or the total disk usage of the configuration files that are in the /etc directory printed in human-readable format. i think i got somewhere right as am using wc *.conf commands but i am unsure how to use to put it in human-readable format with the wc command. ... (13 Replies)
Discussion started by: stefanere2k9
13 Replies
Login or Register to Ask a Question