Logic for file fetching based on date


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Logic for file fetching based on date
# 1  
Old 08-22-2008
Logic for file fetching based on date

Dear friends,

I receive the following files into a FTP location on a daily basis

-rw-r----- 1 guest ftp1 5021 Aug 19 09:03 CHECK_TEST_Extracts_20080818210000.zip
-rw-r----- 1 guest ftp1 2437 Aug 20 05:15 CHECK_TEST_Extracts_20080819210000.zip
-rw-r----- 1 guest ftp1 3564 Aug 21 05:30 CHECK_TEST_Extracts_20080820210000.zip
-rw-r----- 1 guest ftp1 1410 Aug 22 05:22 CHECK_TEST_Extracts_20080821210001.zip

From the above listing, it shows
On Aug-21, we receive file dated 20080820
On Aug-22, we receive file dated 20080821
Which means on a particular day, we will always receive extracts dated [current date -1] i.e previous day suffixed file.

Can you please provide unix command , which will achieve the following:
1] Unix command which when invoked today should pick up a file from above location based on date-suffix logic [current date -1] , i,e it should pick up file dated 21-Aug,,,1.e CHECK_TEST_Extracts_20080821210001.zip when invoked on 22-AUG-2008

2] Unix command , which will identify all the files FTped on a particular day and move them to another location.

For ex: if 2 files are FTPED today as follows:
-rw-r----- 1 guest ftp1 3564 Aug 22 05:30 CHECK_TEST_Extracts_20080820210000.zip
-rw-r----- 1 guest ftp1 1410 Aug 22 05:22 CHECK_TEST_Extracts_20080821210001.zip

Then command should identify these 2 files as received today [22-AUG] and move them to another location

Please advice

Thanks in advance...........
Regards,
Suresh
# 2  
Old 08-22-2008
can you post the result of
Quote:
echo $TZ
# 3  
Old 08-26-2008
CAn some one please reply ?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

To take file based on date passed

Hi Guys, I have certain files in my directory which gets appended with dates something like this T1_aug17.txt T1_Aug17.txt T1_Sep17.txt config.txt T1 T2 my code: curr_date=`date -d "$date" +%Y-%m-%d` path=mydir for file in `cat config.txt` do final_file=$(ls $path/ | grep -i... (12 Replies)
Discussion started by: rohit_shinez
12 Replies

2. Post Here to Contact Site Administrators and Moderators

Read file name based on date

Hi, I have file name as Example extract_ces_v3_p044444rlt_20160514045705.txt.pgp extract_ces_v3_p044444rlt_20160614049705.txt.pgp extract_ces_v3_p044444rlt_20160714046705.txt.pgp I have to read file name based on date(i.e) files with same date and copy to another directory in shell script.... (3 Replies)
Discussion started by: caba_jones
3 Replies

3. HP-UX

HP/UX command to pull file name/date based on date

HI, Can anyone tell me how to pull the date and file name separated by a space using the find command or any other command. I want to look through several directories and based on a date timeframe (find -mtime -7), output the file name (without the path) and the date(in format mmddyyyy) to a... (2 Replies)
Discussion started by: lnemitz
2 Replies

4. Shell Programming and Scripting

Script to determine Date,TotalFile,total size of file based on date

I have file listed like below -rw-r--r--+ 1 test test 17M Nov 26 14:43 test1.gz -rw-r--r--+ 1 test test 0 Nov 26 14:44 test2.gz -rw-r--r--+ 1 test test 0 Nov 27 10:41 test3.gz -rw-r--r--+ 1 test test 244K Nov 27 10:41 test4.gz -rw-r--r--+ 1 test test 17M Nov 27 10:41 test5.gz I... (5 Replies)
Discussion started by: krish2014
5 Replies

5. Shell Programming and Scripting

Fetching values in CSV file based on column name

input.csv: Field1,Field2,Field3,Field4,Field4 abc ,123 ,xyz ,000 ,pqr mno ,123 ,dfr ,111 ,bbb output: Field2,Field4 123 ,000 123 ,111 how to fetch the values of Field4 where Field2='123' I don't want to fetch the values based on column position. Instead want to... (10 Replies)
Discussion started by: bharathbangalor
10 Replies

6. Shell Programming and Scripting

Fetching record based on Uniq Key from huge file.

Hi i want to fetch 100k record from a file which is looking like as below. XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ... (17 Replies)
Discussion started by: lathigara
17 Replies

7. Shell Programming and Scripting

KSH or AWK for fetching the first and the last line based on time.

Dears could anybody please help me with the below task as I am a newbie to programming. I have a text file with 4 columns (priv_ip,time,pub_ip). eg: 10.160.101.160,0708044510,22.203.195.151 10.160.101.160,0708044645,22.203.195.151 10.160.101.160,0708050410,22.203.195.151... (5 Replies)
Discussion started by: BrownBob
5 Replies

8. Shell Programming and Scripting

Help in Logic - How to move files based on a condition

Hi All, I have 2 LINUX scripts (Lets say ScriptA & ScriptB) which copies files (lets say 'date_abc.txt , it goes to a while loop & checks for the files between 2 date varialbles) to directory X. (as Shown Below) These 2 scripts are called from 2 different Autosys schedules & runs at the... (3 Replies)
Discussion started by: dsfreddie
3 Replies

9. Shell Programming and Scripting

Splitting the file based on logic

Hello I have a requirement where i need to split the Input fixed width file which contains multiple invoices into multiple files with 2 invoices per file. Each invoice can be identified by its first line's second character which is "H" and sixth character is " " space and the invoice would... (10 Replies)
Discussion started by: dsdev_123
10 Replies

10. Shell Programming and Scripting

Date Logic

If I do a date + "%b%Y" I get Mar2004. How do I then get unix to tell me that the previous month and year is Feb2004? The logic will also have to work for Jan2005 and Dec2004. Thanks.. (3 Replies)
Discussion started by: lesstjm
3 Replies
Login or Register to Ask a Question