i have got many files like this in my folder temp(say)
imp_02042008.txt for date 02-04-2008
imp_03092009.txt for date 03-09-2009
imp_25112009.txt for date 25-11-2009
...................
........
in some folder.
and one of my shell code uses one of the above files based on date.
for example for todays date it should pick the file imp_25112009.txt
for tomorrows date it should pick the file like imp_26112009.txt
My code is like below one:
print substr($1,4,3),"",substr($2,22,8) inputfile.txt>outputfile.txt
This code should run on day to day basis.
What i want is a code to pick up the file (eg..imp_26112009.txt) automatically from folder temp based on day.. i.e, for a given day particular file should be taken as input in my code...
pls help me in this regard..
---------- Post updated at 07:14 AM ---------- Previous update was at 07:02 AM ----------
pls any coders do look into matter... m novice to shell scripting...
what i want is to pick up file from the temp directory if its todays file.that file will act as input to my code... I already have files in the given form.. i need some code that will search the file(of current date.. i.e for today i need to pick file imp_25112009) from temp directory and place it as input to my code...
wat m searching is code which contains sed or grep or awk...etc something like that...
sorry for disturbance... n thank you for ur help...
what i want is that my code should pick the file corresponding to current date i.e for today it should pick the file imp_02347_26112009_124956_26112009_332.txt
here the numbers before&after 26112009 doesnt make any difference to me..
You might want to try to explain what you mean by things like "pick up the file". Instead use terminology that most people generally understand for instance:
"I want to read the file1 that corresponds to todays date in folder tmp, and input that file into file2.... file2 is located in a different subdirectory, and I need this to run automated. eg. using cron."
rather than "pick up" use terminology like "read or write" "input or output"
unfortunately, I don't know unix programs enough to help I was simply trying to help you get a result, otherwise people generally read through a topic, try to help but get frustrated because they can't understand what the OP is trying to accomplish or what their needs are, and so they unsubscribe and don't bother replying or continuing to help.
However you have been given some guidelines already, you don't need to worry about the automate processes just yet, figure it out until the script works then you can read up on how to use cron: "man cron"