![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to find the latest file on Unix or Linux | duke0001 | UNIX for Dummies Questions & Answers | 10 | 4 Weeks Ago 01:31 AM |
| Shell script to ftp latest file | im_new | Shell Programming and Scripting | 7 | 11-22-2007 10:15 PM |
| finding latest file having timestamp on it..... | kaushik25 | Shell Programming and Scripting | 1 | 08-06-2007 07:35 PM |
| How to find whenther given value is in betwwen min and Max in unix shell scripting | pinky | UNIX for Dummies Questions & Answers | 5 | 07-27-2007 07:52 AM |
| Find and remove all but the latest file | hyennah | Shell Programming and Scripting | 4 | 03-28-2007 08:09 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi guys,
I have a directory in UNIX having files with the below format, i need to pickup the latest file having recent timestamp embedded on it, then need to rename it to a standard file name. Below is the file format: filename_yyyymmdd.csv, i need to pick the latest and move it with the standard file name. Please help. regards, sundar |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
One way:
Code:
now=`date +%Y%m` ls -rt filename_"$now"*.csv | tail | read file cp $file standard_file_name |
|
#3
|
||||
|
||||
|
Please, do not duplicate posts:
http://www.unix.com/shell-programmin...amp-on-it.html |
||||
| Google The UNIX and Linux Forums |