06-04-2007
Picking the file based on Date..Requirement
Dear frnds
My requirement is as follows
-rw-r----- 1 f02 dd 109428250 May 18 14:02 Extracts_20070518104730.zip
-rw-r----- 1 f02 dd 109493187 May 21 13:30 Extracts_20070521091700.zip
-rw-r----- 1 f02 dd 109993058 May 23 14:14 Extracts_20070523085955.zip
-rw-r----- 1 f02 dd 110381316 May 25 15:03 Extracts_2007052509491
I recieve the files every alternate days i.e MOn.. Wed...Fri
Now I need a script which receives a parameter (DateSuffix) which will have default value as "AUTO"
Scenario
-------------
So when I run the script on say 21 May and DateSuffix="AUTO", the script should pick up 18 May file.
when I run the script on say 23 May and DateSuffix="AUTO", the script should pick up 21 May file and son on......
The script shud handle teh month and year changes as well.
Any inputs in this regard is appreciated
Thanks in advance
Suresh
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi frnds,
I have flat file as
.
Say :
output-file1.txt
Output-file2.txt (1 Reply)
Discussion started by: Gopal_Engg
1 Replies
2. Shell Programming and Scripting
HI,
I have to write a unix script and need your help.
in my application where I have to invoke this script a varialble is there where the value comes in a variable . for example variable can be var=ABC
like this there will be any type of value in the vcariable.
there is a unix directory... (2 Replies)
Discussion started by: manish8484
2 Replies
3. Shell Programming and Scripting
Hi Friends,
Newbie to shell scripting. Currently i have used the below to sort data based on filenames and datestamp
$ printf '%s\n' *.dat* | sort -t. -k3,4
filename_1.dat.20120430.Z
filename_2.dat.20120430.Z
filename_3.dat.20120430.Z
filename_1.dat.20120501.Z
filename_2.dat.20120501.Z... (1 Reply)
Discussion started by: robertbrown624
1 Replies
4. UNIX for Dummies Questions & Answers
Hi Friends,
Newbie to shell scripting
Currently i have used the below to sort data based on filenames and datestamp
$ printf '%s\n' *.dat* | sort -t. -k3,4
filename_1.dat.20120430.Z
filename_2.dat.20120430.Z
filename_3.dat.20120430.Z
filename_1.dat.20120501.Z
filename_2.dat.20120501.Z... (12 Replies)
Discussion started by: robertbrown624
12 Replies
5. Shell Programming and Scripting
Hi Team,
I have four shell scripts and i need to put it into one script and call based on requirement.
For example:
If server is Linux and version of my software version is 5 then it should call 1st scipt
If server is Solaris and version of my software version is 6 then it should call... (16 Replies)
Discussion started by: darling
16 Replies
6. Shell Programming and Scripting
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
7. Shell Programming and Scripting
how to move file based on date in linux (1 Reply)
Discussion started by: syedzoniac
1 Replies
8. HP-UX
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
9. Shell Programming and Scripting
Hi ,
I did the initial search but could not find what I was expecting for.
15606Always_9999999997_20160418.xml
15606Always_9999999998_20160418.xml
15606Always_9999999999_20160418.xml
9819Always_99999999900_20160418.xml
9819Always_99999999911_20160418.xmlAbove is the list of files I... (4 Replies)
Discussion started by: chillblue
4 Replies
10. Shell Programming and Scripting
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