how to get the most recent date value


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to get the most recent date value
# 1  
Old 12-02-2008
how to get the most recent date value

I have a set of values like this and sometimes more

source5local_02Dec2008
source5local_01Nov2008
source5local_05Sep2008


I need to retrieve the string with the most recent date
if I cut the date value from each of these strings is there any means to compare them
# 2  
Old 12-02-2008
Grep for Dec?

Do you multiple dates per month?

Say you have:

source5local_02Dec2008

source5local_08Dec2008


This can work

cat file |grep Dec |sort |tail -1
# 3  
Old 12-02-2008
There are MANY treads on here that deal with extracting dates from file names.

The "Search Button" is your friend...
# 4  
Old 12-02-2008
I guess this one should be deleted.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Rsync copying within recent date range?

As many will point out, one of the benefits of using rsync (without --delete) is that it will sync files between source and destination, but not delete files in the destination which HAVE been deleted in the source. Well, I have kind of the opposite problem and I'm wondering if there are date... (2 Replies)
Discussion started by: WIOP33
2 Replies

2. Shell Programming and Scripting

Recent History

Could some let me know the command used to view the commands that I have entered 2 days ago. I am able to perform a command fc -l but its yielding me only last 10 recent events. I need to know the history of the commands that i have entered 2 days ago. Is there anyway that I can get the information... (5 Replies)
Discussion started by: bobby1015
5 Replies

3. Solaris

Recent file available

Dear, Require a script to check : If the file under /opt/OV/log directory has recent 5 hours(or user defined value) file generated or not If generated then cmd to call : opcmsg a=a o=o msg_grp=OpC msg_text="Log file didn't generated on $time" s=critical (1 Reply)
Discussion started by: mjoshi87
1 Replies

4. Shell Programming and Scripting

Getting the most recent file

Hi people, Please some help over here. I have logs in a directory, in which I need to get the most recent file in order to put it within other command. The format of the files are loadfiles20090308094339_41 loadfiles20090308094418_42 loadfiles20090308095457_43... (4 Replies)
Discussion started by: cgkmal
4 Replies

5. Shell Programming and Scripting

To keep only the most recent files

Hi all, I'm running on a Sun Solaris machine. I would only want to keep the last 2 most recent files on 1 of my directory. Below shows my script, but it is incomplete. For the ?? part I do not know how to continue. please help:confused: DIR=/tmp/abc OUTPUT=/tmp/output.out... (1 Reply)
Discussion started by: *Jess*
1 Replies

6. Shell Programming and Scripting

getting the most recent file

Hi, I have files coming in every day with that days timestamp like: nameyyyymmddhhmmss.ext. I need the most recent one and so i am using cat `ls -t name*|head -1 ` > temp i am sorting the files in the decending order and am copying the most recent one into a temp file. It works at times... (3 Replies)
Discussion started by: anujairaj
3 Replies

7. AIX

Changing name of most recent file

I need to change the name of a file within a script. For example I have two files. The first named scrnslc_0001 and the second scrnslc_0002. I want to change the name of the second to scrnslc_out. The appended number will change, and I won't know the file name in advance. If there were only one... (1 Reply)
Discussion started by: warpmail
1 Replies

8. Shell Programming and Scripting

Most Recent File script

OK, I know next to nothing about scripting in unix, and at the moment I don't have access to a unix environment... We have an application that generates a text report file which is later printed. The format is this: bbtptcYYMMDDSSCC.txt (year/month/day/second/check digit) I want a... (1 Reply)
Discussion started by: josborn777
1 Replies

9. Post Here to Contact Site Administrators and Moderators

Recent Changes To Forum ...

Hi all, Have noticed that changes have been made to the forum's main page. The number of new posts/threads is no longer active/visible. Is this a tempoary amendment or a permanent one? Whilst I can not speak for all, I actually refered to the missing line each time I logged on. (2 Replies)
Discussion started by: Cameron
2 Replies
Login or Register to Ask a Question