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
Tracking down the problem mattmanuel UNIX for Advanced & Expert Users 3 11-16-2007 05:51 AM
Tracking user panknil UNIX for Advanced & Expert Users 5 06-25-2007 08:40 AM
tracking user action xitrum UNIX for Advanced & Expert Users 7 03-07-2007 12:48 PM
Command Tracking mahatma UNIX for Advanced & Expert Users 5 04-04-2006 05:30 AM
event number tracking frustrated1 Shell Programming and Scripting 4 01-09-2006 03:17 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-21-2006
Registered User
 

Join Date: Aug 2003
Location: Ireland
Posts: 269
Stumble this Post!
tracking sequence num

I have files coming to an input directory every few mins...eg

test_00012.txt
test_00013.txt
test_00014.txt

I need to write a script to monitor these and if a file is missing from the sequence I need my script to spot this so I can alert someone...

ie... if I got the following:
test_00012.txt
test_00014.txt
test_00015.txt

I am missing the file with seq num... how do I spot this in a script so I can alert it?
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 02-21-2006
Registered User
 

Join Date: Dec 2005
Location: India
Posts: 218
Stumble this Post!
Hi ,
one suggestion,
cut the sequence numbers from the first and last file names after sorting file names, somthing like this

1) ls -lrt *test*|sort (seq no.)| cut the seq no. of first and last using head and tail.
2) get number of files by subtracting last and first no.
3) get the no of files using ls -lrt *test* |wc -l
4) compare the result in step 2 and 3.
5) If they are same everything is fine otherwise somthing is missing

Gaurav
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 04:47 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