Variable TIME


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Variable TIME
# 1  
Old 03-17-2011
Question Variable TIME

Hello.

I need to capture files from a server with format XXXYYYYMMDDHHMMSS.tar.gz, I have defined the DATE but how I can resolve the issue of time?




Best regards.
Rob
# 2  
Old 03-17-2011
What's the issue?
# 3  
Old 03-17-2011
What in unix command terms is "capture"? Please give examples of commands which work.

What Operating System and version are you using? If the target server is different, what does it run?
What Shell do you prefer?

Reading between the lines I guess that this is a wildcard question. The solution depends on context.
# 4  
Old 03-17-2011
Code:
man date

       %k     hour ( 0..23)
       %M     minute (00..59)
       %S     second (00..60)

# 5  
Old 03-18-2011
Variable TIME

Sorry to all.
SunOS devsap 5.10 Generic_125100-09 sun4u sparc SUNW,Sun-Fire-V240
I'm try to get a file from server X with a shell script.
This file in server X have the format "......YYYYMMDDHHMMSS.tar.gz".
I defined one variable DATE=`date +%Y%m%d%H%M%S` butI can never to get the file.
How I can solve the time?.
Best regards.
Robert.
# 6  
Old 03-18-2011
It probably has the timestamp based on the file's creation time. Unless that file has precreated files for each possible second during the day you won't get any files by using the current time.
# 7  
Old 03-18-2011
Variable TIME

Yes Perderabo, this is the question.
I think not use %H%M%S and to create a variable and set value greater zeros (set -gt zeros) and so on. I don't know.
I'll try other options, when I have the solution I will write in this forum.
Many thanks for your collaboration and patience.
Roberto.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Date/Time parts to variable as integer

Hi Guys, i guess there is a several ways to grub the strings from date and time like THISMONTH='/bin/date +%m' but the hard part is to add or sub that string to a variable i tried to use let command TWOMONTHSAGO=$THISMONTH declare -i TWOMONTHSAGO let TWOMONTHSAGO-=2 but there... (1 Reply)
Discussion started by: CyR0iz4l1v3
1 Replies

2. Shell Programming and Scripting

Script to subtract time stored in a variable

Hello, I am writing a script to find time difference between two timestamp stored in a variable. i have two variable t1=11:48:30 t2=13:13:48 how i can find the difference i.e t2-t1 in seconds. Please help (4 Replies)
Discussion started by: anand2308
4 Replies

3. SuSE

Need to assign value to a variable and export it at the same time

I have a file a.xml contaning: <customerId>999</customerId> <aaa>09876</aaa> Now I want to extract the value '999' and save it in a variable and then export the variable. Something like the below: export CUSTOMER_ID=cat a.xml |grep customerId |awk -F ">" '{print $2}' |awk -F "<" '{print... (3 Replies)
Discussion started by: RomitaaChawla@1
3 Replies

4. Shell Programming and Scripting

Using same variable in 2 different scripts that run at the same time

Hi, I have two scripts that use the same variable. Say suppose I export that variable in script 1 and try to use it in script 2 where I have declared it locally, what will be the effective value of the variable? Will it take the exported value or the locally declared? example: Script1... (4 Replies)
Discussion started by: PraveenSikamani
4 Replies

5. Shell Programming and Scripting

[gnuwin32] sed & variable %TIME%

HI.. I made ".bat" in windows 2003 , with set TIEMPO1= %TIME% | sed -e "s/://g" -e "s/,//g" echo valor de tiempo1 = %TIEMPO1% when i execute this, the result is but if i open cmd, and execute en line command this.. G:\>echo %TIME% | sed -e "s/://g" -e "s/,//g" 12390841 anyone have... (5 Replies)
Discussion started by: upszot
5 Replies

6. Shell Programming and Scripting

Convert value stored in a variable to epoch time?

Hello I have a the creation date of a file stored in a variable in the following format: Wed May 06 10:14:58 2009Is there a way I can echo the variable and display it in epoch time? I've done a lot of searching on this topic, but haven't managed to get a solution. I'm on Solaris 10. ... (2 Replies)
Discussion started by: Glyn_Mo
2 Replies

7. Shell Programming and Scripting

value of variable based on time of the day

i would need some help in setting the value of a variable (TIME_NOW) depending on the time of the day ...e.g. if today's date is 12th April 2009 and if the current time is between midnight and 16:59:59 hrs then the TIME_NOW should be yesterday's date i.e. TIME_NOW=11 else if the current time... (3 Replies)
Discussion started by: zainravi
3 Replies

8. Shell Programming and Scripting

Set a variable that changes every time?

Do not know how to do this, any help would be appreciated: I have a file that comes in called xxxx.txt. I have a script that does some messing around with the file. The file needs to go out as PAB108XXXX.csv The four x's above will be a number that changes everytime the script is ran e.g.... (1 Reply)
Discussion started by: Pablo_beezo
1 Replies

9. UNIX for Advanced & Expert Users

how to set the environment variable at run time

hi, I have one environment variable like path in my system.But in my program i need to change that path .suppose it has a value "config" now i need to chage it as "config1" or something else.i need to use that variable for complete project.It means at first it will use the old path but after... (4 Replies)
Discussion started by: sada@123
4 Replies

10. Shell Programming and Scripting

Substituting variable with current time

Hi all I have a script as follows :- #!/usr/bin/ksh IDT=`date +"%OH%M%S"` while true do echo ${IDT} sleep 1 done I need the time to show me the current runtime value for the time, however this returns the time as at the start of the script. Any ideas. Thanks JH (4 Replies)
Discussion started by: jhansrod
4 Replies
Login or Register to Ask a Question