Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: UNIX script
On Tue, 29 Mar 2005 15:45:21 +0300, The Human Fly
<sjaffarhussain_at_gmail.com> wrote:
> Hello list,
>
> Sorry, its slightly off-topic, UNIX related.
>
> My requirement is whenever I divert my output to a file, that should
> contains filename along with the data and time.
>
> For example,
>
> ls -ltr > xyz
>
> and next time when I do the same, it should ot overwite to the file,
> instead create the file with date and time along with it.
You need to use the date command:
# ls -ltr > xyz.`date [options]`
Note that ` is the backtick which causes the shell to execute what they contain as a command and pipe the output back.
I can't remember the options off the top of my head. Check the man page for the date command. As I recall 'xyz.`date +%Y%m%d`' should, today, give you 'xyz.20050329' but test it first.
Stephen
-- It's better to ask a silly question than to make a silly assumption. -- http://www.freelists.org/webpage/oracle-lReceived on Tue Mar 29 2005 - 07:58:54 CST
![]() |
![]() |