file name query

Hi Everyone . i m kinda newbie so spare me if question seems stupid :smiley:
what i want to do is something like this

rsh node1 tail -20 /var/opt/fds/statistics/FSC-InapInterface_2.0_A_1-2006-12-24-0000.stat >> node1.txt

now problem is this that in this case the date was 24th december 2006 but that file has new name everyday ( the date portion changes ) , how can i ammend above given line to work like that it gets date from system and then put it in above line .. so that i dont have to change this text every day ..
i hope i m making myself clear . if not kindly lemme know
thanks in advance and waiting for any help

use,

`date +%Y-%m-%d`

tried this

rsh node1 tail -20 /var/opt/fds/statistics/FSC-InapInterface_2.0_A_1-'date +%Y-%m-%d'-2-0000.stat >> node1.txt

aint working :frowning:

Be careful with the quotes:

They shoul be: `
Try this way instead, if you like:

sh node1 tail -20 /var/opt/fds/statistics/FSC-InapInterface_2.0_A_1-$(date +%Y-%m-%d)-2-0000.stat >> node1.txt

Anyway, this last file name is not the same you wrote on your 1st post...

that wont work!

take care of the backticks :slight_smile:

Why not assign the system date time to a variable like in the example below.
TIME_SEC=`date +-%Y-%m-%d-%H%M` gives you -2007-01-09-1043
TIME_SEC=`date +%Y%m%d%H%M` gives you 200701091044
You can then use the variable $TIME_SEC in your script.
Hope this helps.