The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
UrgentPlease: compare 1 value with file values eliminating special characters kittusri9 Shell Programming and Scripting 10 04-28-2008 04:51 AM
compare two col from 2 files, and output uniq from file 1 pp56825 Shell Programming and Scripting 2 01-10-2008 11:10 AM
I need to extract last column of a file and compare the values vukkusila Shell Programming and Scripting 4 08-04-2007 11:21 AM
compare 2 files, output dups to file blt123 UNIX for Dummies Questions & Answers 2 07-15-2004 10:31 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 09-02-2007
shiroh_1982
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
Aggregate values in a file & compare with sql output

Hi,

I have a file containing the following data:

junk123junk723itemcode001qty01price10total10junkjunk
junk123junk723itemcode002qty02price10total20junkjunk
..
..
..
could be 5000+ lines

I have an algo and need a code to implement this:
1. Linecount = wc -l (should give 5000)
2. For i = 1 to linecount (loops 5000 times)
3. pick up the value from total and aggregate them ie 10 + 20 = 30
4. This should be done fr all the lines and the total aggregated total in a variable called TOTAL.
5. The total aggregate should be compared against a database query ie:

total_database=`sqlplus -s un/pw@TNS_NAME<<END
set pagesize 0
set feedback off
set heading off
set echo off
set verify off
select total from results;
exit;
END`
echo "$total_database"

If $ total_database = $TOTAL then pass, else echo fail..

Can someone kindly help me out with this.I hope I gave in enough info..

Thanks and Regards,
Ron.
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:50 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0