extracting files using date in ksh


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers extracting files using date in ksh
# 1  
Old 04-04-2006
extracting files using date in ksh

Hi All.,

1 ssssss C2052EX 15 Mar 30 19:01
1 aaaaa C2052EX 15 Apr 3 10:12
1 ccccc C2052EX 15 Apr 4 09:28

i have files arriving like above.
i am using the following to extract files arriving today ( say apr4)

todaydat=`date | cut -c5-10`
find DIR_PATH/START.*.*.*.ctl* -exec ls -ltr {} \; -mmin +200 | grep "$todaydat" | awk -F" " {'print $9'}

now i am trying to extract files arriving today ( say apr 4) and y'day ( say apr 3)
can anyone please give me any suggestions.

thanks
pavi
# 2  
Old 04-04-2006
extracting files arrived today and yesterday

Hello

i am using these ( from man pages in Unix)
yesterdaydat=date -d "yesterday" | cut -c5-10
Apr 3

todaydat=date | cut -c5-10
Apr 4

now i am trying to use the output of both the above commands to extract the files arrived today and yesterday. can you please give me a suggestion;

find DIR_PATH/START.*.*.*.ctl* -exec ls -ltr {} \; -mmin +200 | grep
"$todaydat" | awk -F" " {'print $9'}

thanks a bunch
pavi
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Print start date to end date, given $1 & $2 in ksh

Dear all, I have an user passing 2 parameter 31/03/2015 and 02/04/2015 to a ksh script. How to print the start date to end date. Expected output is : 31/03/2015 01/04/2015 02/04/2015 Note : 1. Im using aix and ksh 2. I have tried to convert the given input into a date, didnt... (0 Replies)
Discussion started by: mr.rajaravi
0 Replies

2. Shell Programming and Scripting

Extracting log files based on date and time.

Hi All, i have some log files generated in a folder daily with the format abc.def.20130306.100001 ghi.jkl.20130306.100203 abc.def.20130305.100001 ghi.jkl.20130305.100203 the format is the date followed by time . all i want is to get the files that are generated for todays... (3 Replies)
Discussion started by: mahesh300182
3 Replies

3. UNIX for Advanced & Expert Users

Help with ksh script to list, then cp files from a user input date range

Hi, I'm quite new to ksh scripting, can someone help me with this. Requirements: I need to create a script that list the files from a user input date range. e. g. format of file: *c1*log.2012-12-22-14-00* *c1*log.2012-12-22-14-00* *c1*log.2012-12-22-14-00*... (1 Reply)
Discussion started by: chococrunch6
1 Replies

4. UNIX for Dummies Questions & Answers

Unable to convert date into no. using date -d +%s syntax in ksh shell

hi friends, I m trying to write a script which compares to dates. for this i am converting dates into no using synatx as below v2=`date | awk '{print $2,$3,$4}'` v3=`date +%s -d "$v2"` this syntax is working in bash shell ,but fails in ksh shell. please suggest on this. (12 Replies)
Discussion started by: Jcpratap
12 Replies

5. Shell Programming and Scripting

ksh compare dates INSIDE a file (ie date A is > date B)

In KSH, I am pasting 2 almost identical files together and each one has a date and time on each line. I need to determine if the first instance of the date/time is greater than the 2nd instance of the date/time. If the first instance is greater, I just need to echo that line. I thought I would... (4 Replies)
Discussion started by: right_coaster
4 Replies

6. Shell Programming and Scripting

How to Get 60 days Old date from current date in KSH script

Hi i am writing a cron job. so for it i need the 60 days old date form current date in variable. Like today date is 27 jan 2011 then output value will be stote in variable in formet Nov 27. i am using EST date, and tried lot of solution and see lot of post but it did not helpful for me. so... (3 Replies)
Discussion started by: Himanshu_soni
3 Replies

7. Shell Programming and Scripting

ksh shell script to add date (YYYYMMDDHHMISS) to all .txt files in a folder

Everyday 15 files are written to a folder \app\where\thefiles\are\destined\CURRFOLDER Task1: I need to add date in YYYYMMDDHHMISS format to each of them. Example: File: ACCOUNT.txt Should be updated as: ACCOUNT_20101005175059.txt Task 2: After I update the files, they need to be ... (2 Replies)
Discussion started by: Duminix
2 Replies

8. Shell Programming and Scripting

Help extracting process name from ps command AIX using KSH

Hi All, Newbie script writer and I need some help! I'm grepping ps - eno THREAD >outfile This gives me loads of stuff including the proc names which appear at the end of the line. They're all 10 characters long so what I want to do is cut them (and only them) from the file and put it in... (7 Replies)
Discussion started by: Grueben
7 Replies

9. Shell Programming and Scripting

want to get previous date from date command in ksh

I want to get previous date from date command. I am using ksh shell. Exmp: today is 2008.09.04 I want the result : 2008.09.03 Please help. Thanks in advance. (4 Replies)
Discussion started by: rinku
4 Replies

10. Shell Programming and Scripting

Perl: Extracting date from file name and comparing with current date

I need to extract the date part from the file name (20080221 in this ex) and compare it with the current date and delete it, if it is a past date. $file = exp_ABCD4_T-2584780_upto_20080221.dmp.Z really appreciate any help. thanks mkneni (4 Replies)
Discussion started by: MKNENI
4 Replies
Login or Register to Ask a Question