The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #5 (permalink)  
Old 05-13-2008
jim mcnamara jim mcnamara is online now
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 3,805
I just used your example filenames.

Code:
# this line was file="20080501000001.dat"
ls -rt  part1_*`date "+%Y%m%d`*.dat | tail -1 read file
This find the last occurrence of the file - ie. the highest sequence number for a file received today. the variable "file" is just the filename with the newsest sequence embedded in it.
Assuming I got your requirements.
Reply With Quote