I have files in the directory like below which I need to validate if all the required files are present.
Scenarios-
a)If file with 001 of 002_time1 or 002 of 002_time1 is missing in the folder,script should fail.Script should pass only if 2 files are present
b)At the same time if there is any other file with 001 of 001 or 001of 002,002 of 002 with different timestamp,script should pass.
Eg:In the above case script should pass since all the files are there
But if the files are like below,script should fail since 002 0f 002_time2 is missing
File count for each timestamp can vary i.e.it may be 001 of 001 on one day and 3 files on another.
When I extract the 2nd part of the count in the filenamei.e.002 and compare with the total count,the code works if there are only 2 files.But if there is an additional file with 001 of 001 or 001 of 002,002 of 002 process fails.
Pls help.
Thanks in advance.
Last edited by Scrutinizer; 03-15-2013 at 06:34 AM..
Reason: code tags
This specification is absolutely unreadable! If I guess its meaning correctly, you have a number of files per timestamp, with the file number, the maximum file number, and the timestamp being part of the file name. You want to check if the count of files per timestamp is identical to the maximum file number. For this, try
If you can make sure that there's never MORE files than max no., this will do:
ls *.txt will fail if there are too many .txt files in the directory, whereas ls will never fail. You could read all the files provided by the plain ls and only process those that end with .txt.
Thanks for the help..I have tried to explain better this time..
Now my reqmt suddenly changed..I need to use a looping mechanism t check if all the files are available ignoring the timestamp.
I just need to ignore time1,time2 basically timestamp.I need to perform this for all the files in the directory matching the file mask(A_B_*.txt)
Considering 1 set of files,I need a loop to check if all the files for that particular set are available..
like...
Output:file is missing
Code like..
I need help on the looping logic..Pls help ..
Thanks
Moderator's Comments:
Also use code tags for pseudo code
Last edited by Scrutinizer; 03-18-2013 at 03:15 AM..
Reason: code tags also for pseudo code..
I am attempting to write a korn shell script that does the following, but I am getting errors. I'm new to korn shell scripting and am not sure what I am doing wrong. Please help with example scripts. Thanks.
1) check for day of the week
2) if day of the week is Monday then check for the... (4 Replies)
I want to write a korn shell script to get the latest three versions for a file in the directory having lot of files with various versions (files with prefix as same but time stamp as suffix) and compress it and at the same time have to remove the remaining versions of the file (other than latest... (4 Replies)
Hi,
I am looking for a ready shell script that can help in loading and validating a high volume (around 4 GB) .Dat file . The data in the file has to be validated at each of its column, like the data constraint on each of the data type on each of its 60 columns and also a few other constraints... (2 Replies)
this is my issue.
4 parameters are passed from korn shell to sql script.
parameter_1= varchar2 datatype or no value entered my user.
parameter_2= number datatype or no value entered my user.
parameter_3= number datatype or no value entered my user.
parameter_4= number datatype or no... (5 Replies)
All,
Can anyone please help me with the below scenario in korn shell script.
Can anyone please give me some hints to proceed on this.
I have a Flat file of the below format.
Input file format:... (1 Reply)
The scope of the shell/perl script is to read the input text file. Validate the expiry date of each certificate and send the mail to the user. The user takes action to add the new certificate to the storage file and user owns the responsibility to update the input text file with the new certificate... (5 Replies)
Hi,
I am new to this unix scripting, I got a requirement like..
Files with *.XML extension will be generating in a /home/sample/ folder for every 15 mins. I need to monitor those files in that particular folder for every hour.
If no file has been generated in that particular folder for an... (7 Replies)
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)
Hello,
How do I write a korn shell that will rename file with the current date. What I want to do is, I have a file that is re-written every day. But instead, I want to keep a 14 day history of the file. So I want to write a script that will rename the current file with a date attached to the... (2 Replies)
I am attempting to itterate through a file that has multiple lines and for each one read the entire line and use the value then to search in other files. The problem is that instead of an entire line I am getting each word in the file set as the value I am searching for. For example in File 1... (2 Replies)