Need script to validate file according to date


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need script to validate file according to date
# 1  
Old 09-13-2012
Need script to validate file according to date

Hi All,

I am very new to unix and just started to work with unix and shell scripting.I have a query anyone help would be much appreciated

I am using sun solaris OS
I want to validate a file according to its date and if validate successful then it would write the file name,size,date and time only in a log file

For example

suppose a file

-rw-r--r-- 1 xxxxxx xxxx 2400390 Sep 10 08:50 test.dat

this file actually received on every monday of a week so i want a script that check whether it is of current date or not if it is the it would appear in my log file otheriwse not.
# 2  
Old 09-13-2012
But when / how will test? Testing today to see if the file is current is not the same as testing on monday...
# 3  
Old 09-13-2012
Hi,

Thanks for your prompt response.

I mean if the script execute today it should not take that file in my log file.And if that script execute on monday it should appear in my log file.

I want that script to run daily so that i can validate number of such files.

So just starting with unix i just want to get through a single file date validation.
# 4  
Old 09-13-2012
A script that runs daily is a batch launch by a scheduler like cron... if so where is your script going to get the name of the file it needs to compare the date?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to validate header in a csv file

Hi All; I am struggling to write a script that validates file header. Header file would be like below with TAB separated TRX # TYPE REF # Source Piece Code Destination Piece Code every time I need to check the txt file if the header was same as above fields if validation success... (6 Replies)
Discussion started by: heye18
6 Replies

2. Shell Programming and Scripting

Script to validate dates inside a file

Hi All, Looking forward a script with below requirement.Please let me know if any pointers. - there is a file which contains date - script will go inside the file and validate date is T-1 and for Friday T-3 - Send email with status -Shell is Ksh (2 Replies)
Discussion started by: dattatraya
2 Replies

3. Shell Programming and Scripting

Validate date file format using awk

Here is my sample data Test.txt column 1|columne 2|start Date|end Date test|test|03/24/2014|03/24/2014 test|test|03/24-2014|03/24/2014 test|test|03/24/2014|03/24/2014 test|test|03/24/2014|03/24-2014 test|test|03/24/2014|03/24/2014 Now in the file i am expecting the date fields should be... (4 Replies)
Discussion started by: krish2014
4 Replies

4. Shell Programming and Scripting

Need a ready Shell script to validate a high volume data file

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)
Discussion started by: Guruprasad
2 Replies

5. Shell Programming and Scripting

Validate file count in korn shell script

Hi, I have files in the directory like below which I need to validate if all the required files are present. A_B_001 of 002_time1.txt A_B_002 of 002_time1.txt A_B_001 of 001_time2.txt Scenarios- a)If file with 001 of 002_time1 or 002 of 002_time1 is missing in the folder,script should... (6 Replies)
Discussion started by: aneeta13
6 Replies

6. Shell Programming and Scripting

Script to validate file header and trailer

Hi, I need a script that validates a file header/detail/trailer. File layout is: Header - Rec_Type|File_name|File_Date Detail - Rec_Type|field1|field2|field3... Trailder - Rec_Type|File_name|File_Date|Record_count Sample Data: HDR|customer_data.dat|20120709... (7 Replies)
Discussion started by: ash_sh
7 Replies

7. Shell Programming and Scripting

The scope of the shell/perl script is to read the input text file. Validate the expiry date of each

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)
Discussion started by: casmo
5 Replies

8. Shell Programming and Scripting

Validate date format in argument

Hi.. I'm a newbie in KSH. Need help. How can I validate input date format in argument using format mm/dd/yy. Eg. > findlog.sh 12/30/09. Any info/help is highly appreciated. (3 Replies)
Discussion started by: harry0013
3 Replies

9. Shell Programming and Scripting

Need to validate a date input format

Hi all, I have a shell script(K shell) which takes a date as input. i want the input to be in DD-MM-YYYY format. Can i enforce such a format of input string using just one line of code? OR do i need to parse the input date into different components and test them using Case statements... (2 Replies)
Discussion started by: rajugp1
2 Replies

10. Shell Programming and Scripting

Validate date

Hi I am beginner to UNIX. I wanted to help for how to write script to validate date. Please help me. (2 Replies)
Discussion started by: giridher2000
2 Replies
Login or Register to Ask a Question