date ranges


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting date ranges
# 1  
Old 07-15-2009
date ranges

Hi,
Please anyone help to achive this using perl or unix scripting .
Code:
This is date in my table 20090224,based on the date need to check the files,If file exist for that date then increment by 1 for that date and check till max date 'i.e.20090301 and push those files .
files1_20090224
files2_20090225
files3_20090226
files4_20090227
files4_20090228
files4_20090301

script :I am not sure how to handle the date addition and check.

echo "----------------------------------------------------------------------" >/Temp/a.log

$ORACLE_HOME/bin/sqlplus -S 'Username/password@DB1'<<! | tee -a >/Temp/a.log

SELECT TO_CHAR(START_DT,'YYYYMMDD') FROM test WHERE FREQ='D';

!

date=`awk NF a.log |egrep -iv 'to_char|-----'`

echo $date
.............
...........

Thanks ,
Akil
# 2  
Old 07-15-2009
Save your current date in currDate and then use Oracle to get the next date...
Code:
select to_char(to_date($currDate,'YYYYMMDD')+1,'YYYYMMDD') from dual;

Once you get the date store it in nextDate
and search for the file
Code:
ls file?_$nextDate

If you find the file take necessary action.
# 3  
Old 07-15-2009
Hi
You mean to say that if check for 5 days ,need to query 5 times ,Is there any way to dynamic this?

Thanks,
Akil
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grepping the data between 2 date ranges

Hi There, Good Day !! I have txt file containing data in the below format. There are many lines, here i have mentioned for example. cat remo.txt 2/3/2017 file1 3/4/2016 file2 6/6/2015 file5 1/1/2018 file3 4/3/2014 file4 - - - I need to grep the file names for given date rage... (11 Replies)
Discussion started by: kumar85shiv
11 Replies

2. UNIX for Beginners Questions & Answers

Search files between date ranges - Ctime usage

Hello, I am a noob and need some help. I am trying to find files created between a date range. For Example: These are files in directory. -rw-r--r-- 1 user staff 6 May 8 09:43 file1.txt -rw-r--r-- 1 user staff 6 May 8 09:43 file2.txt -rw-r--r-- 1 user... (8 Replies)
Discussion started by: r@v!7*7@
8 Replies

3. Programming

Derivation of values falling on date ranges

Hi Guys, I am having below tables used in oracle bal ID BALANCE BAL_DATE 1 -11.71 01-JAN-05 00.00.00 1 -405.71 02-JAN-05 00.00.00 1 -760.71 03-JAN-05 00.00.00 ref_table PRODUCT EFF_FROM_DATE EFF_TO_DATE TYPE MIN_AMT MAX_AMT CHARGE 12 01-JAN-05 00.00.00 01-JAN-06... (6 Replies)
Discussion started by: rohit_shinez
6 Replies

4. Shell Programming and Scripting

Values between ranges

Hi, I have two files file1 chr1_22450_22500 chr2_12300_12350 chr1_34500_34550 file2 11000_13000 15000_19000 33000_44000 If the file 1 ranges fall between file2 ranges then assign the value of file2 in column 2 to file1 output: chr2_12300_12350 11000_13000 chr1_34500_34550 ... (7 Replies)
Discussion started by: Diya123
7 Replies

5. Shell Programming and Scripting

getting files between specific date ranges in solaris

hi ! how can i get files in a directory between certain date ranges ? say all files created/modified between Jan24 - Jan31 thanks (10 Replies)
Discussion started by: aliyesami
10 Replies

6. UNIX for Dummies Questions & Answers

Problem with ranges of numbers

Good day to everyone! So, let's start :) I have a file with a numbers in some ranges for example: 1 10 49 72 ... and this file need to transform to: 1 2 3 4 (14 Replies)
Discussion started by: shizik
14 Replies

7. UNIX for Dummies Questions & Answers

Need help filling in ranges

I have a list of about 200,000 lines in a text file that look like this: 1 1 120 1 80 200 1 150 270 5 50 170 5 100 220 5 300 420 The first column is an identifier, the next 2 columns are a range (always 120 value range) I'm trying fill in the values of those ranges, and remove... (4 Replies)
Discussion started by: knott76
4 Replies

8. Linux

search on weblogic logs with date time ranges

Hi All, The developers want me to search and capture the weblogic log, you know this big logs of htmls. They want to me to have ranges on the date and time. Like from "2010-01-20 14:04:46,186" to "2010-01-20 15:00:12,490" I can only do this, cat /usr/local/bea/logs_prod1/debug.log... (1 Reply)
Discussion started by: itik
1 Replies

9. Shell Programming and Scripting

search on weblogic logs with date time ranges 2

Hi All, The developers want me to search and capture the weblogic log, you know this big logs of htmls. They want to me to have ranges on the date and time. Like from "2010-01-20 14:04:46,186" to "2010-01-20 15:00:12,490" I can only do this, cat /usr/local/bea/logs_prod1/debug.log |... (1 Reply)
Discussion started by: itik
1 Replies

10. Shell Programming and Scripting

find command: various date ranges

Hi, I have writtena script that will recursivly go into subdirecotries and report out what files there are in there that have not been accessed over various date ranges. I do this using a number of find commands: find . -path './.snapshot' -prune -o -type f -atime -8 find... (4 Replies)
Discussion started by: littleIdiot
4 Replies
Login or Register to Ask a Question