Computing.Net > Forums > Unix > Assign Date to a Var

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

Assign Date to a Var

Reply to Message Icon

Name: Nish
Date: September 30, 2002 at 00:26:04 Pacific
OS: Solaris 7
CPU/Ram: 256
Comment:

Dear All,
My OS : Solaris and Shell is ksh.
I have a requirement to assign date to a variable.
I tried following and failed.

myvar=date '+ %y%m%d_%h'

After that I need to do an awk fo all the files containing the same date and hour. (File name consists of date and hour)
eg. Myfile_NAME_020930_1325.0010
Therefore I need to awk all files that created this hour.
Appreciate your Help.



Sponsored Link
Ads by Google

Response Number 1
Name: David Perry
Date: September 30, 2002 at 03:56:40 Pacific
Reply:

find . -name "*myvar*" -exec ls -l {} \;


0

Response Number 2
Name: David Perry
Date: September 30, 2002 at 03:58:14 Pacific
Reply:

Sorry. That should have been

find . -name "*$myvar*" -exec ls -l {} \;


0

Response Number 3
Name: jimbo
Date: September 30, 2002 at 04:45:08 Pacific
Reply:

Here you go:

myvar=`date + %y%m%d_%h`

Use Backquotes

-jim


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Piping script gcc for SVR4.0



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: Assign Date to a Var

Assign File modify time to a Var www.computing.net/answers/unix/assign-file-modify-time-to-a-var/5605.html

Extract the max no. in the File Ext www.computing.net/answers/unix/extract-the-max-no-in-the-file-ext/4485.html

Assign to a Variable www.computing.net/answers/unix/assign-to-a-variable/4408.html