Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script to run a program and generate a text file from AIX

Status
Not open for further replies.

pravin4batman

Technical User
May 19, 2015
4
US
I want to run a script which would generate a text file daily with filename "ABCD_YYYYMMDD.TXT" format. I have a macro recorded to generate the file however I would need to know as to how file would be created depending on a date. in short, today the file generated would be "abcd_20150519.txt" then tomorrow it should generate a file with name "abcd_20150520.txt"
 
How do I declare this file name using VB? I have a recorded macro and would be making changes to the same so that it can retrieve today's (the day script runs) date.
 
sorry, no idea. I was answering under the assumption that you will run it on AIX.
 
Sorry about the confusion!
I would running the script in AIX.
Here is what i do- I run a query in AIX and the data generated from query should be saved to a text file. The text file will have name as "ABCD_Date"
Do you propose any other way to do this?
 
Ah, I see. That is what I meant. In the script that runs the query you make up the file name as I suggested:
[tt]fname=ABCD_$(date "+%Y%m%d").TXT[/tt]

then when the query gets executed you just redirect it to the file as in:

[pre]line-invoking-the-query >/put/directory/here/${fname}[/pre]

Does this help?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top