The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
hell and sqlite ogoy Shell Programming and Scripting 2 05-20-2008 09:07 PM
rpm hell! knmwt15000 UNIX for Dummies Questions & Answers 7 03-27-2002 02:06 AM
mathematics in shell script sureshy UNIX for Dummies Questions & Answers 2 03-21-2002 08:04 AM
mathematics operations in unix cesar720213 UNIX for Dummies Questions & Answers 2 11-22-2001 07:24 AM
negative UID/GID?!! I can see 'em but what the hell do they mean?! hellz UNIX for Dummies Questions & Answers 2 09-07-2001 12:18 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-26-2008
Registered User
 

Join Date: May 2008
Posts: 5
Stumble this Post!
hell & mathematics

I've been able to generate output based on the code scarfake provided me (thanks again man).

A little background so everyone more or less knows whats going on:

I needed code that would propagate a database with 100,000 entries, for capacity testing purposes, something like a stress test.

Now I have the results based on timestamps. The timestamps are shown as [1211425845].

[22445] [1211425845](1Jz1CX-0007Qa-7X) MINE::EXIMDB::SF::wblist_check BEGIN
[22445] [1211425846](1Jz1CX-0007Qa-7X) MINE::EXIMDB::SF::wblist_check END

I was told these timestamps are in seconds. Which means the above output equates to a 1 second interval from beginning (BEGIN) to end (END).

If anyone can provide code that would do the math showing how many second(s) intervals per BEGIN and END.

My grep command might help:

grep "BEGIN\|END" /mine/output.log

Thanks for looking
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 05-26-2008
jaduks's Avatar
Registered User
 

Join Date: Aug 2007
Location: Assam,India
Posts: 145
Stumble this Post!
Is your expected output is something like this ?

Code:
$  sed -n '/BEGIN\|END/ s_\[\(.*\)\].*\[\(.*\)\].*_\2_p' og.txt
1211425845
1211425846
//Jadu
Reply With Quote
  #3 (permalink)  
Old 05-26-2008
 

Join Date: Nov 2007
Location: 45.48-73.63
Posts: 564
Stumble this Post!
Quote:
Originally Posted by ogoy View Post
If anyone can provide code that would do the math showing how many second(s) intervals per BEGIN and END.
Code:
awk '$NF=="BEGIN"{a=substr($0,10,10)}$NF=="END"{print substr($0,10,10)-a}' data.file

Last edited by danmero; 05-26-2008 at 06:41 PM. Reason: get shorther
Reply With Quote
  #4 (permalink)  
Old 05-26-2008
Registered User
 

Join Date: May 2008
Posts: 5
Stumble this Post!
Jaduks, yes that is the expected output.

danmero, that code did it, strange now that I see 0's in the results, goes to show that we need to put more stress into the tests!

Thanks guys
Reply With Quote
  #5 (permalink)  
Old 05-26-2008
 

Join Date: Nov 2007
Location: 45.48-73.63
Posts: 564
Stumble this Post!
Quote:
Originally Posted by ogoy View Post
, strange now that I see 0's in the results, goes to show that we need to put more stress into the tests!
Add nanoseconds to timestamps for precision.
Reply With Quote
  #6 (permalink)  
Old 05-26-2008
Registered User
 

Join Date: May 2008
Posts: 5
Stumble this Post!
Thanks for the tip, I'll look into that.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 11:58 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0