The UNIX and Linux Forums  

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



Thread: simple script
View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 01-22-2008
ThobiasVakayil ThobiasVakayil is offline
Registered User
 

Join Date: May 2006
Posts: 53
If you want to select the file which are created in the latest date, you have to do like this :

mon=`ls -lrt | awk '{print $6}' | tail -1`
day=`ls -lrt | awk '{print $7}' | tail -1`

for file in `ls -l | grep "$mon $day" | awk '{print $9}'`
do
echo $file
done
Reply With Quote