Subtract 2 days from timestamp


 
Thread Tools Search this Thread
Operating Systems Solaris Subtract 2 days from timestamp
# 8  
Old 09-19-2016
Solaris 11.3 has gnu date as gdate mostly by default.
By default i mean someone takes text install, it will get solaris-small-server group package which includes a lot of gnu utilites.

From AI installer or using manifest for zone install you can install solaris-minimal-server which will not include those and many others (good for zones)
Installation Group Package Content for SPARC Based Systems -
Oracle(R) Solaris 11.3 Package Group Lists


Also other gnu utilities are available with g prefix (gsed, gawk, gtar etc.)

Hope the helps
Regards
Peasant.
# 9  
Old 09-19-2016
Quote:
Originally Posted by shamrock
It'd be a breeze if you know perl...
This kind of answer really frustrates the person asking the question. it's not constructive and doesn't really aid in solving the issue. I'm sure a lot of our questions can be answered similarly but doesn't give an immediate solution.

---------- Post updated at 12:21 PM ---------- Previous update was at 12:14 PM ----------

are you working comparing files based on a timestamp?

if so you can do something like

Code:
if [[ $i -nt $NEWER ]];

See:

Introduction to if

specifically:

[ FILE1 -nt FILE2 ] True if FILE1 has been changed more recently than FILE2, or if FILE1 exists and FILE2 does not.
[ FILE1 -ot FILE2 ] True if FILE1 is older than FILE2, or is FILE2 exists and FILE1 does not.
[ FILE1 -ef FILE2 ] True if FILE1 and FILE2 refer to the same device and inode numbers.
# 10  
Old 09-22-2016
Quote:
Originally Posted by os2mac
This kind of answer really frustrates the person asking the question. it's not constructive and doesn't really aid in solving the issue. I'm sure a lot of our questions can be answered similarly but doesn't give an immediate solution...
The reason for such an answer is to encourage the OP to come up with a solution instead of having others write it for them...the forumites are here to help but dont expect us to spoon feed others...
# 11  
Old 09-22-2016
Quote:
Originally Posted by shamrock
The reason for such an answer is to encourage the OP to come up with a solution instead of having others write it for them...the forumites are here to help but dont expect us to spoon feed others...
which is why I answered the way I did. To point them in the correct direction rather than giving them the code to do it themselves but by just saying

x would be simple if you programmed in y. would answer just about every question on here.

all you are really doing is being snarky.
# 12  
Old 09-22-2016
Moderator's Comments:
Mod Comment Keep on-topic, please. Several solutions have been presented and there's no need for acrimony.


There's little to discuss until the OP gets back to this thread in any case.
# 13  
Old 09-22-2016
Quote:
Originally Posted by os2mac
which is why I answered the way I did. To point them in the correct direction rather than giving them the code to do it themselves but by just saying

x would be simple if you programmed in y. would answer just about every question on here.

all you are really doing is being snarky.
I'm not trying to start a flame war here but IMO a nudge in the right direction isn't snarky Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. HP-UX

awk command in hp UNIX subtract 30 days automatically from current date without date illegal option

current date command runs well awk -v t="$(date +%Y-%m-%d)" -F "'" '$1 < t' myname.dat subtract 30 days fails awk -v t="$(date --date="-30days" +%Y-%m-%d)" -F "'" '$1 < t' myname.dat awk command in hp unix subtract 30 days automatically from current date without date illegal option error... (20 Replies)
Discussion started by: kmarcus
20 Replies

2. Shell Programming and Scripting

Get a given date and subtract it to 5 days ago

Hi all, I have been researching to obtain SSL certification expiry for most of our webistes. For some cases, some hosts where not directly accessible so i finally got a solution working with curl using my proxy. This lists the expiry date which i'm finally looking for. # curl --proxy... (4 Replies)
Discussion started by: nms
4 Replies

3. Shell Programming and Scripting

Grep lines between last hour timestamp and current timestamp

So basically I have a log file and each line in this log file starts with a timestamp: MON DD HH:MM:SS SEP 15 07:30:01 I need to grep all the lines between last hour timestamp and current timestamp. Then these lines will be moved to a tmp file from which I will grep for particular strings. ... (1 Reply)
Discussion started by: nms
1 Replies

4. Shell Programming and Scripting

AIX : Need to convert UNIX Timestamp to normal timestamp

Hello , I am working on AIX. I have to convert Unix timestamp to normal timestamp. Below is the file. The Unix timestamp will always be preceded by EFFECTIVE_TIME as first field as shown and there could be multiple EFFECTIVE_TIME in the file : 3.txt Contents of... (6 Replies)
Discussion started by: rahul2662
6 Replies

5. Shell Programming and Scripting

To check timestamp in logfile and display lines upto 3 hours before current timestamp

Hi Friends, I have the following logfile. Currently time in india is 07/31/2014 12:33:34 and i have the following content in logfile. I want to display only those entries which contain string 'Exception' within last 3 hours. In this case, it would be the last line only I can get the... (12 Replies)
Discussion started by: srkmish
12 Replies

6. Shell Programming and Scripting

Subtract months/days from date

Hi, Can you please let me know code for the below (in korn shell) a) Subtract month(s) from given date b) Subtract day(s) from give date c) Subtract month(s) from given timestamp d) Subtract day(s) from give timestamp (1 Reply)
Discussion started by: tostay2003
1 Replies

7. Shell Programming and Scripting

Subtract 2 date columns in .csv file and get output as number of days

Hi, I have one .csv file. I have 2 date columns present in file, column 2 and column 3. I need to calculate how many days exist between 2 dates. I am trying to subtract date column 2 from date column 3. Eg: my file look likes s.no, Start_date,End_Date 1, 7/29/2012,10/27/2012 2,... (9 Replies)
Discussion started by: Dimple
9 Replies

8. UNIX for Advanced & Expert Users

Subtract days to a date in AIX 5.3

good afternoon, can someone help me, I need to make a script where n subtract days to a date. I am using AIX 5.3. Greetings. (4 Replies)
Discussion started by: systemoper
4 Replies

9. UNIX for Dummies Questions & Answers

How to compare a file by its timestamp and store in a different location whenever timestamp changes?

Hi All, I am new to unix programming. I am trying for a requirement and the requirement goes like this..... I have a test folder. Which tracks log files. After certain time, the log file is getting overwritten by another file (randomly as the time interval is not periodic). I need to preserve... (2 Replies)
Discussion started by: mailsara
2 Replies

10. Shell Programming and Scripting

Subtract days from a variable holding date

Hi, could someone help on this.. I have a date in variable procdate="05/30/2009" I would want to Subtract it with 3 or 4 (2 Replies)
Discussion started by: infernalhell
2 Replies
Login or Register to Ask a Question