Hi,
I need subtract two date values (which are in day of the year format) and the output would give the remaining days. using the command date +"%j" i would get today's 'day of the year' i.e.,
Next, i need to take input of a previous date in the format 09/05/2012 and then convert it to 'day of the year format'. Could anyone please help how i could do this?
Note: I'm using HP-UX
Do you have GNU date? if yes you can refer its man page.. if not you have to rely on good old days of date logic convert them to minutes and do minus then convert back to number of days or years so...
To keep the forums high quality for all users, please take the time to format your posts correctly.
First of all, use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags [code] and [/code] by hand.)
Second, avoid adding color or different fonts and font size to your posts. Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red.
Third, be careful when you cut-and-paste, edit any odd characters and make sure all links are working property.
Hi,
First of all, thanks for all the awesome suggestions on this forum. This helps all the UNIX enthusiast like me.
Now, I had a similar requirement as mentioned in a very old post here:
Question about Perderabo's "Days Elapsed Between Two Dates"
But I am struggling what to change in the... (5 Replies)
Hello,
I am having hard time calculating the time differnce in the below sequence. I tried nested for loops but I can't get to work.
Algorithm:
find time difference between the first AVAIL and the next event just before AVAIL.
0 05/17/2010 09:33 AVAIL <-- 1
1 05/17/2010 09:32 UM ... (2 Replies)
Imagine that you play poker and the file 1.txt is your buy-in, and in 2.txt is your gains. I want to know the tournament that have more proffit and less proffit.
1.txt
aa:1000
bb:2000
cc:3000
dd:4000
ee:5000
2.txt
aa:0
bb:1000
cc:1500
dd:3000
ee:2000
Result: dd more profit; aa... (5 Replies)
In C that was easy with a for and if. Iam trying to learn a litle more in bash.
Example
Ronaldo:5800
Figo:4000
Rafael:2321
Kaka:1230
I want the max of the $2 and the output will be:
The max value is 5800 from Ronaldo.
How can i do this in shell?
Thanks for all, folks. (11 Replies)
I everybody!!
How can i use statvfs() to calculate disk usage and free disk space??
Im using this code:
/* Any file on the filesystem in question */
char *filename = "/home/nesto/test/test.cpp";
struct statvfs buf;
if (!statvfs(filename, &buf)) {
... (1 Reply)