Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Aggregate values in a file & compare with sql output Post 302134658 by ghostdog74 on Sunday 2nd of September 2007 07:40:30 AM
Old 09-02-2007
assuming the total is always 2 digits.
Code:
# total=$(awk '{match($0,"total");c=c+substr($0,RSTART+5,2)}END{print c}' file)
# echo $total
30

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

small script - get sql output & write into txt

Hi, how can I write a small script to run the following statement and output the result into check_result.txt select /*+RULE*/ tapname from typetbl where tapname like 'AA%' and rejectcode=9; Normally, I just type sql and get into SQL> (2 Replies)
Discussion started by: happyv
2 Replies

2. 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

3. Shell Programming and Scripting

Compare two file & output

Hi every body i have a problem need help urgently file 1 (approx 200K entries) aaaaa bbbb cccccc dddd ffff file 2 (approx 2 million entries) aaaaa,1,ee,44,5t,6y, bbbb,3,ff,66,5u,8r, cccccc, ..... dddd, ..... eeeeee, ..... ffff, ...... (5 Replies)
Discussion started by: The_Archer
5 Replies

4. Shell Programming and Scripting

Awk Multiple Files & Aggregate

file 1: 70|236|PPS|0501011818|mms|20090706|001452|00000024|2|0000000000000000|00000|0000000000|0000000000|40948000|1 70|236|PPS|0501020076|mms|20090705|204408|00000019|2|0000000000000000|00000|0000000000|0000000000|40947930|1... (3 Replies)
Discussion started by: magedfawzy
3 Replies

5. Shell Programming and Scripting

Output of Unix & SQL in same file

output of Unix & sql in same file hi all, am working on shell script, i need to format data in such a way that both my Unix commands output & my sql output should be in a same file. I am able to redirect both output in separate files. for sql output: sqlplus -s... (6 Replies)
Discussion started by: bankimmehta
6 Replies

6. Shell Programming and Scripting

How to Pass the Output Values from the PL/SQL Procedure to Shell Script?

hi, Could anyone tell me how to pass the output values of the PL/SQL procedure to Shell script and how to store that values in a shell script variable... Thanks in advance... (5 Replies)
Discussion started by: funonnet
5 Replies

7. Shell Programming and Scripting

compare columns for equal values and output a summary

Hi all I am trying to scan a file that has 3 columns: red blue 123351 red blue 848655 red blue 126354 red blue 023158 black white 654896 red blue 650884 I want an output that sums the rows that have matching columns 1 and 2 :wall: red blue has 5 entries black white has 1 entry ... (4 Replies)
Discussion started by: reno
4 Replies

8. Shell Programming and Scripting

Compare values in two files. For matching rows print corresponding values from File 1 in File2.

- I have two files (File 1 and File 2) and the contents of the files are mentioned below. - I am trying to compare the values of Column1 of File1 with Column1 of File2. If a match is found, print the corresponding value from Column2 of File1 in Column5 of File2. - I tried to modify and use... (10 Replies)
Discussion started by: Santoshbn
10 Replies

9. Shell Programming and Scripting

LINUX - How to compare the values in 2 files & exit from the script

Hi All, I have a requirement where I need to compare 2 files & if the values in the files match, it should proceed, else exit the script without proceeding further. For e.g : Scenario 1 In this case, the script should exit without proceeding further. Scenario 2 In this case, the script... (7 Replies)
Discussion started by: dsfreddie
7 Replies

10. UNIX for Dummies Questions & Answers

How to compare to values returned from sql in shell scripting?

hey i am using this code to connect to sql , store the value in variable and then compare it with another variable after some time by executing the same query but the desired result is not coming #!/bin/bash val=$(sqlplus -s rte/rted2@rel76d2 <<ENDOFSQL set heading off set feedback off... (11 Replies)
Discussion started by: ramsavi
11 Replies
Test::Aggregate::Nested(3pm)				User Contributed Perl Documentation			      Test::Aggregate::Nested(3pm)

NAME
Test::Aggregate::Nested - Aggregate "*.t" tests to make them run faster. VERSION
Version 0.364 SYNOPSIS
use Test::Aggregate::Nested; my $tests = Test::Aggregate::Nested->new( { dirs => $aggregate_test_dir, verbose => 1, } ); $tests->run; DESCRIPTION
ALPHA WARNING: this is alpha code. Conceptually it is superior to "Test::Aggregate", but in reality, it might not be. We'll see. This module is almost identical to "Test::Aggregate" and will in the future be the preferred way of aggregating tests (until someone comes up with something better :) "Test::Aggregate::Nested" requires a 0.8901 or better of "Test::More". This is because we use its "subtest" function. Currently we "croak" if this function is not available. Because the TAP output is nested, you'll find it much easier to see which tests result in which output. For example, consider the following snippet of TAP. 1..2 1..5 ok 1 - aggtests/check_plan.t ***** 1 ok 2 - aggtests/check_plan.t ***** 2 ok 3 # skip checking plan (aggtests/check_plan.t ***** 3) ok 4 - env variables should not hang around ok 5 - aggtests/check_plan.t ***** 4 ok 1 - Tests for aggtests/check_plan.t 1..1 ok 1 - subs work! ok 2 - Tests for aggtests/subs.t At the end of each nested test is a summary test line explaining which program we ran tests for. "Test::Aggregate::Nested" asserts a plan equal to the number of test files aggregated, something which "Test::Aggregate" could not do. Because of this, we no longer export "Test::More" functions. If you need additional tests before or after aggregation, you'll need to run the aggregated tests in a subtest: use Test::More tests => 2; use Test::Aggregate::Nested; subtest 'Nested tests' => sub { Test::Aggregate::Nested->new({ dirs => 'aggtests/' })->run; }; ok $some_other_test; CAVEATS
"Test::Aggregate::Nested" is much cleaner than "Test::Aggregate", so I don't support the "dump" argument. If this is needed, let me know and I'll see about fixing this. The "variable will not stay shared" warnings from "Test::Aggregate" (see its CAVEATS section) are no longer applicable. AUTHOR
Curtis Poe, "<ovid at cpan.org>" BUGS
Please report any bugs or feature requests to "bug-test-aggregate at rt.cpan.org", or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Aggregate <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Aggregate>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. SUPPORT
You can find documentation for this module with the perldoc command. perldoc Test::Aggregate You can also look for information at: o AnnoCPAN: Annotated CPAN documentation http://annocpan.org/dist/Test-Aggregate <http://annocpan.org/dist/Test-Aggregate> o CPAN Ratings http://cpanratings.perl.org/d/Test-Aggregate <http://cpanratings.perl.org/d/Test-Aggregate> o RT: CPAN's request tracker http://rt.cpan.org/NoAuth/Bugs.html?Dist=Test-Aggregate <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Test-Aggregate> o Search CPAN http://search.cpan.org/dist/Test-Aggregate <http://search.cpan.org/dist/Test-Aggregate> ACKNOWLEDGEMENTS
Many thanks to mauzo (<http://use.perl.org/~mauzo/> for helping me find the 'skip_all' bug. Thanks to Johan LindstrA~Xm for pointing me to Apache::Registry. COPYRIGHT &; LICENSE Copyright 2007 Curtis "Ovid" Poe, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.4 2011-08-27 Test::Aggregate::Nested(3pm)
All times are GMT -4. The time now is 04:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy