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 > 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 and shell scripting languages 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-21-2008 12:07 AM
rpm hell! knmwt15000 UNIX for Dummies Questions & Answers 7 03-27-2002 06:06 AM
mathematics in shell script sureshy UNIX for Dummies Questions & Answers 2 03-21-2002 12:04 PM
mathematics operations in unix cesar720213 UNIX for Dummies Questions & Answers 2 11-22-2001 11: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 03:18 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-26-2008
ogoy ogoy is offline
Registered User
  
 

Join Date: May 2008
Posts: 7
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
  #2 (permalink)  
Old 05-26-2008
jaduks's Avatar
jaduks jaduks is offline
Registered User
  
 

Join Date: Aug 2007
Location: Assam,India
Posts: 166
Is your expected output is something like this ?

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

Join Date: Nov 2007
Location: 45.48-73.63
Posts: 1,369
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 09:41 PM.. Reason: get shorther
  #4 (permalink)  
Old 05-26-2008
ogoy ogoy is offline
Registered User
  
 

Join Date: May 2008
Posts: 7
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
  #5 (permalink)  
Old 05-26-2008
danmero danmero is offline Forum Advisor  
  
 

Join Date: Nov 2007
Location: 45.48-73.63
Posts: 1,369
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.
  #6 (permalink)  
Old 05-26-2008
ogoy ogoy is offline
Registered User
  
 

Join Date: May 2008
Posts: 7
Thanks for the tip, I'll look into that.
Sponsored Links
Closed Thread

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 06:57 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
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