Computing.Net > Forums > Unix > call file dynamically

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

call file dynamically

Reply to Message Icon

Name: navin
Date: September 2, 2003 at 14:23:41 Pacific
OS: solaris
CPU/Ram: 256
Comment:

I have a job that needs to run daily. I need to write a shell script which will pick up a input file that is generated daily. The generated file is going to have the jobname with sysdate and some more characters appended to it. In this, jobname is going to remain same, the syadate will change daily and the last few characters will be generated daily automatically.

e.g. the name of the file will be :
on 26 th - abc20030826123
on 27 th - abc20030827234
on 28 th - abc20030828568

How can I call this file in the script.

Thanks,
Navin



Sponsored Link
Ads by Google

Response Number 1
Name: LANkrypt0
Date: September 3, 2003 at 05:37:01 Pacific
Reply:

This actually should not be that hard, you have known portions of the file, the abcYYYMMDD part, so you could easily search for that, and it would be unique as only one file is generated that day.

I simply used:
#!/bin/ksh
getfile=$(ls | grep abc$(date +"%Y%m%d"))
$getfile

That did a list of files, grep'd for the date in the specific abcYYYYMMDD format as that is not changing, and produced one file.



0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: call file dynamically

Read File name and pass to SQLoader www.computing.net/answers/unix/read-file-name-and-pass-to-sqloader/5543.html

substring of a text string www.computing.net/answers/unix/substring-of-a-text-string/5608.html

core file process www.computing.net/answers/unix/core-file-process/1006.html