Script for automatic count the file i have


 
Thread Tools Search this Thread
Operating Systems Solaris Script for automatic count the file i have
# 1  
Old 09-04-2008
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  
Old 09-04-2008
Try this.. If I dont get your question wrong... Smilie

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

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

sumemr
# 4  
Old 09-05-2008
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
# 5  
Old 09-05-2008
Quote:
Originally Posted by summerpeh
Hi

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

sumemr
Sorry, I really don't understand your statement
# 6  
Old 09-05-2008
Humm i guess i don have GNU date command.
is there other way?

Summer
# 7  
Old 09-05-2008
Perhaps you could say what operating system and shell you are using so we can better answer your question.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

File count script not working properly

Hi Experts, I have this script to count the number of files based on prefix and suffix values. #!/bin/ksh file_date=$1 prefix=$2 suffix=$3 file_count=$(ls -l /db/day_file/{$prefix}*${file_date}*{$suffix}) The files in the directory /db/day_file are as below. 20170501 20170501... (7 Replies)
Discussion started by: nalu
7 Replies

2. Shell Programming and Scripting

Script Shell: Count The sum of numbers in a file

Hi all; Here is my file: V1.3=4 V1.4=5 V1.1=3 V1.2=6 V1.3=6 Please, can you help me to write a script shell that counts the sum of values in my file (4+5+3+6+6) ? Thank you so much for help. Kind regards. (3 Replies)
Discussion started by: chercheur111
3 Replies

3. Shell Programming and Scripting

SSH Script For Automatic File Upload HELP

Hi guys! I hope this hasn't been asked too many times but, Would someone be able to help me write or point me in the direction to some helpful tutorials in order to write a script to transfer a file directly to a server via SSH from a linux based computer. The script should do as following:... (2 Replies)
Discussion started by: craigwilkinson
2 Replies

4. Shell Programming and Scripting

awk script to count characters in file 1 in file 2

I need a scripting AWK to compare 2 files. file 1 and 2 are list of keywords 1 is a b c d 2 is aa aaa b bb ccc d I want the AWK script to give us the number of times every keyword in file 1 occurs in file 2. output should be a 2 (7 Replies)
Discussion started by: anhtt
7 Replies

5. Shell Programming and Scripting

Help with script to read lines from file and count values

Hi, I need some help with a script I'm trying to write. I have a log file containing references to a number of different webservices. I wish to write a script that will list the webservices with a count as to how many times they appear in the log. An example of the log file content: ... (2 Replies)
Discussion started by: gman2010
2 Replies

6. Shell Programming and Scripting

Help to write a script or program to automatic execute and link input file data

Output file template format <input_file_name>a</input_file_name> <total_length_size>b</total_length_size> <log_10_length_size>c</log_10_length_size> Input_file_1 (eg. sample.txt) SDFSDGDGSFGRTREREYWW Parameter: a is equal to the input file name b is equal to the total length of... (2 Replies)
Discussion started by: perl_beginner
2 Replies

7. Shell Programming and Scripting

shell script to get the arrival count of file

Hello All, I have come across a small problem. It would be great if any of you could help me in resolving the issue. one file named dummy.txt will be ftped to Unix machine twice daily. If i receive it second time in a day i need to do some processing with the file. How to find the... (2 Replies)
Discussion started by: RSC1985
2 Replies

8. Shell Programming and Scripting

Help On Unix Script Count Line Of File

I have to compare the number of files of two files on a Shell Script: I tryied with wc and wiith sed but I can not make an integer... #!/bin/sh . . n = ls -l | wc -l $file1 `echo "Line: "$n". ">>$LOGFILE` xx = sed -n '$=' $file2 `echo "Line: "$xx". ">>$LOGFILE` Aways... (4 Replies)
Discussion started by: fafo77
4 Replies

9. Solaris

Script for automatic deletion of trash file of mail server

Hi, I have a mail server with limited space and operating system is sun solaris 8 (sparc). I do not have provisions to increase the space for home directory. So i have to delete files from /home/username/mail/trash which are more than 10 days old automatically. So my script should be like... (1 Reply)
Discussion started by: crown2100bd
1 Replies

10. Shell Programming and Scripting

Automatic download of csv file using a shell script

I want to automatically download a CSV file daily which can be found here: http://www.londonstockexchange.com/en-gb/pricesnews/prices/coveredwarrants/search.htm and the link is named "Click to download covered warrants (100Kb)" onthe right hand side. What commands can I use to invoke clicking... (1 Reply)
Discussion started by: figaro
1 Replies
Login or Register to Ask a Question