Date command comparision with a different format


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Date command comparision with a different format
# 1  
Old 09-11-2015
Wrench Date command comparision with a different format

I have a script called " passwd_status " which gives the passwd-s status of my servers.
the script output is like below

Code:
password status for A:
 abc ks 10/05/115 1 30 ps
  password status for B: 
abc ks 09/25/115 1 30 ps 
 password status for C: 
abc ks 10/10/115 1 30 ps

Now , i want to write a script that for 25 days the password should change automatically. But i am finding difficulty in subtracting the dates . because the date format is like
Code:
"%m%d%1y"

. So how can i subtract this format date with current date and then compare the difference with 25 .

can anyone help me in this.
# 2  
Old 09-11-2015
Is there any particular reason you created a new thread for the already existing one?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Command to check date format DDMMYYYY

Record: Record1|Record2|Record3|Record4|Record5|DATE1|DATE2 Need to Check DATE1 & DATE2 is in DDMMYYYY format in a file. records which not meet the date format DDMMYYYY extract to other file. (1 Reply)
Discussion started by: vivekn
1 Replies

2. Shell Programming and Scripting

Need command for date format

hi all, i had a requirement in my script iam passing the parameter like (its not the system date iam passing as argument like it can be any date) 2014-08-25 but in my output file it should be 08/25/2014 please guide me thanks in advance hemanthsaikumar (3 Replies)
Discussion started by: hemanthsaikumar
3 Replies

3. Shell Programming and Scripting

Date command format

Hi, I need to convert a date format "August 12, 2013 9:40:00 PM CDT" in to DD/MM formant For example ..I am using ... date -d "January10, 2013 04:05:00 AM CST" +%m/%d which gives me... 01/10 However, when i'am using it against every month it is throwing errors on some months as... (3 Replies)
Discussion started by: Kevin Tivoli
3 Replies

4. UNIX for Dummies Questions & Answers

Rename all Files in a UNIX Directory from one date format to another date format

Hi Unix Gurus, I would like to rename several files in a Unix Directory . The filenames can have more than 1 underscore ( _ ) and the last underscore is always followed by a date in the format mmddyyyy. The Extension of the files can be .txt or .pdf or .xls etc and is case insensitive ie... (1 Reply)
Discussion started by: pchegoor
1 Replies

5. Shell Programming and Scripting

Display date in mm/dd/yy format in sed command

Hi All, Following is my issue. $MAIL_DOC = test.txt test.txt contains the following text . This process was executed in the %INSTANCE% instance on %RUNDATE%. I am trying to execute the following script var=`echo $ORACLE_SID | tr ` NOW=$(date +"%D") sed -e... (3 Replies)
Discussion started by: megha2525
3 Replies

6. Shell Programming and Scripting

How to change date format in 'last' command?

hi.. i am new to here. can anybody tell me how can we change the date format in the 'last' command. EX- on running last command i am getting -- rruat pts/12 172.18.40.101 Tue May 3 12:59 still logged in rruat pts/10 blr2-3f-239.asco Tue May 3 12:59 - 13:09 ... (2 Replies)
Discussion started by: thearpit
2 Replies

7. Shell Programming and Scripting

Format of SED command to change a date

I have a website. I have a directory within it with over a hundred .html files. I need to change a date within every file. I don't have an easy way to find/replace. I need to change 10/31 to 11/30 on every single page at once. I tried the command below but it didn't work. Obviously I don't know... (3 Replies)
Discussion started by: ijustsawmars
3 Replies

8. HP-UX

Date format of ll command

Hi, Unix: HP-UNIX. I have a requirement(part of my requirement) to get latest file modification date of all files(In a particular directory). Using ll comand i m able to find out the modification date but not in the required format My command and out put: echo trp_pb.sql `ll... (2 Replies)
Discussion started by: satyadash
2 Replies

9. Shell Programming and Scripting

Which is the STRING format in the date command?

Hi According with the 'date' command documentation My question is, which are the possible values for STRING? I have been looking in the man pages but I didn't find anything? After some googling I have found it can have special values as 'now', 'yesterday' or 'tomorrow'. If it represents... (1 Reply)
Discussion started by: islegmar
1 Replies

10. Shell Programming and Scripting

convert date format to mysql date format in log file

I have a comma delimited log file which has the date as MM/DD/YY in the 2nd column, and HH:MM:SS in the 3rd column. I need to change the date format to YYYY-MM-DD and merge it with the the time HH:MM:SS. How will I got about this? Sample input 02/27/09,23:52:31 02/27/09,23:52:52... (3 Replies)
Discussion started by: hazno
3 Replies
Login or Register to Ask a Question