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 > Operating Systems > SUN Solaris
.
google unix.com



SUN Solaris The Solaris Operating System, usually known simply as Solaris, is a free Unix-based operating system introduced by Sun Microsystems .

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Automatic script TShirt UNIX for Advanced & Expert Users 5 06-05-2008 05:34 AM
Help On Unix Script Count Line Of File fafo77 Shell Programming and Scripting 4 02-11-2008 07:30 AM
Script for automatic deletion of trash file of mail server crown2100bd SUN Solaris 1 09-20-2007 09:01 AM
Automatic download of csv file using a shell script figaro Shell Programming and Scripting 1 01-13-2007 08:53 PM
How to count the record count in an EBCDIC file. oracle8 UNIX for Dummies Questions & Answers 1 07-26-2006 08:22 PM

Closed Thread
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 Rating: Thread Rating: 1 votes, 5.00 average. Display Modes
  #1 (permalink)  
Old 09-04-2008
summerpeh summerpeh is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 24
Script for automatic count the file i have

Hi

I have a folder will all the file ftp in everyday. I have to go in every morning to check to see everynight have all the 2000+ file have been all FTP in.

so every morning i will check like this

# ls -l *_20080904*_20080904* |wc

if there is 2714 that mean is correct.

File name: summer_3024190_200809041200_2008090413000.csv

Can someone help me to generate a script so that everyday i just need to check the log file will do?

Thanks in adv

Summer
  #2 (permalink)  
Old 09-04-2008
incredible incredible is offline Forum Advisor  
Registered User
  
 

Join Date: May 2008
Location: s'pore
Posts: 2,088
Try this.. If I dont get your question wrong...

#!/bin/ksh
cd /
lines=`ls -l *_20080904*_20080904* |wc -l`
if [ ${lines} -eq 2714 ]
then
echo "Good"
exit 1
else
echo "Bad"
fi
  #3 (permalink)  
Old 09-04-2008
summerpeh summerpeh is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 24
Hi

erm well 20080904 is a data of yesterday. can the script grep yesterday automatic?

sumemr
  #4 (permalink)  
Old 09-05-2008
incredible incredible is offline Forum Advisor  
Registered User
  
 

Join Date: May 2008
Location: s'pore
Posts: 2,088
Quote:
Originally Posted by summerpeh View Post
Hi

erm well 20080904 is a data of yesterday. can the script grep yesterday automatic?

sumemr
Sorry, I really don't understand your statement
  #5 (permalink)  
Old 09-05-2008
Annihilannic Annihilannic is offline Forum Advisor  
  
 

Join Date: May 2008
Location: Sydney, Australia
Posts: 1,009
Do you have the GNU date command? If so you can try:

Code:
YESTERDAY=$(date --date yesterday +%Y%m%d)
lines=$(ls *_${YESTERDAY}*_${YESTERDAY}* |wc -l)

Last edited by Annihilannic; 09-05-2008 at 12:07 AM.. Reason: typos galore
  #6 (permalink)  
Old 09-05-2008
summerpeh summerpeh is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 24
Humm i guess i don have GNU date command.
is there other way?

Summer
  #7 (permalink)  
Old 09-05-2008
Annihilannic Annihilannic is offline Forum Advisor  
  
 

Join Date: May 2008
Location: Sydney, Australia
Posts: 1,009
Perhaps you could say what operating system and shell you are using so we can better answer your question.
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 07:54 PM.


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