datecalc question.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting datecalc question.
# 1  
Old 05-08-2008
datecalc question.

I have a script that works perfectly on a linux box, but I am going to have to move it over to solaris which I have never really worked with. I was a bit miffed that date -d was not available on solaris so I started looking for alternative soltuoins and found this forum and datecalc.

But I have a question beofre I attempt to use it. Does it allow parsing the date output like the date command does? Such as I need to output like "05/07/08"? Is that available.. I cant really tell by reading the documentation.

Also can anyone point me to any other way to actually accomplish what date -d is able to accomplish... or better yet, does anyone know if there is a solaris package available for gnu date?

Thanks,
Trey
# 2  
Old 05-08-2008
rd=`date +%d/%m/%y`
echo $rd

hope that help
# 3  
Old 05-08-2008
Quote:
Originally Posted by adhit
rd=`date +%d/%m/%y`
echo $rd

hope that help
Well, yeah I guess it helped, but thats not the command I was looking for help with. I was looking for help with the datecalc script Smilie
# 4  
Old 05-08-2008
Ksh93 provides builtin date arithmetic via printf %T and does anything date -d can do and lots more. If ksh93 is not available on your system, you can always download the ksh93 binary for the particular version of Solaris you have from research.att.com.
# 5  
Old 05-08-2008
Quote:
Originally Posted by fpmurphy
Ksh93 provides builtin date arithmetic via printf %T and does anything date -d can do and lots more. If ksh93 is not available on your system, you can always download the ksh93 binary for the particular version of Solaris you have from research.att.com.
thanks for the info, for the time being I installed coreutils from sunfreeware.org. ksh93 is available, so Ill see if I can get a handle on the verbiage of printf %T for future use and rewrites of this script. Im not the worlds best scripter so it may be too much for me to tackle quickly enough to rewrite everything I need in ksh.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to subtract time by 10 minutes in datecalc tool

Hi guys. I am trying to subtract 10 minutes from the current Unix system date and time. I have the datecalc provided here but it is mainly the date and not the time. Please check on how can i subtract 10 minutes from the current time using datecalc or any other shell scripting that will... (2 Replies)
Discussion started by: bantiloe
2 Replies

2. Shell Programming and Scripting

bc question

i'm trying to parse a file with lines like the below where i need to get a diff on the 169-182 so that the result is 13 for instance. I was looking into using bc but am not that familiar with embedding it in a script. john8:9. 169-182 any ideas are appreciated! (5 Replies)
Discussion started by: nlevens
5 Replies

3. UNIX for Dummies Questions & Answers

Doubt in datecalc.....

I have a doubt in date conversion. Can anyone explain the logic behind the date2jd and jd2date in datecalc function specified in this forum. I could not understand what the number are actually representing. Please explain...bcoz i am doing a program with this one.. Note: No need to... (1 Reply)
Discussion started by: sivakumar.rj
1 Replies

4. UNIX for Dummies Questions & Answers

How to use datecalc for adding hours

Hello: I need to generate two datetimestamps in one hour apart. the start date is 05262008000000 then generate the following dates 05262008010000 05262008020000 05262008030000 ... ... ... ... ... ... 05262008230000 05272008000000 05272008010000 05272008020000 05272008030000 ...... (5 Replies)
Discussion started by: ucbus
5 Replies

5. Shell Programming and Scripting

datecalc

Is there no simple way using 'date' command just to get number of days from given date. ie. if I pass 2007-01-15 as an argument. I want to obtain result as 015 Simarly for 2007-02-10. I want to obtain result as 41. Can't this be achieved by simple 1 or 2 lines of command (date). As this is... (1 Reply)
Discussion started by: tostay2003
1 Replies

6. Shell Programming and Scripting

Need a help Please- runing the perderabos script datecalc

i have a script in bourne called cdrsnokia.sh and inside of it calls a script called resta_dias where it calls the datecalc script (perderabos date calculator). The purpose is to rest (-) one day arithmetical operation the content of each line and the result is passed to another file lista2;after... (1 Reply)
Discussion started by: alexcol
1 Replies

7. UNIX for Dummies Questions & Answers

a question

I was experimenting with redirection. Manual says >&digit --> standard output is redirected to the file descriptor digit I tried exec 3>myout exec >&3 This sent all the output to myout. Nothing was coming on the screen. I was thinking duplication will result in output similar to what... (7 Replies)
Discussion started by: ranj@chn
7 Replies

8. UNIX for Dummies Questions & Answers

mv question

Hello if I like to move file from defined directories system to new directory that not contained any directories system structure . But I like to create the same file system structure as source directory for example : I have 2 directories: foo1 and foo2 foo1 have directories and foo2 have... (2 Replies)
Discussion started by: umen
2 Replies

9. Solaris

vi question

Im trying to edit a 113 meg file in VI and i get the error TMP FILE TOO LARGE. Does someone know how to get around this? Thanks! (1 Reply)
Discussion started by: BG_JrAdmin
1 Replies
Login or Register to Ask a Question