Unix/Linux Go Back    

Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Find files and sort by timestamp

Shell Programming and Scripting

find files and sort by timestamp

Thread Tools Search this Thread Display Modes
Old Unix and Linux 07-14-2017
lalitpct lalitpct is offline
Registered User
Join Date: May 2011
Last Activity: 14 July 2017, 12:37 AM EDT
Posts: 49
Thanks: 6
Thanked 0 Times in 0 Posts
Find files and sort by timestamp

Used below command to get list of files sorted by timestamp

 find -L . -type f -name '*dat*'  | xargs ls -ltrg

I want to get only the filenames so I tried adding basename but it doenst work , can some one advise on how to get only file name
Sponsored Links
Old Unix and Linux 07-14-2017
Scrutinizer's Unix or Linux Image
Scrutinizer Scrutinizer is offline Forum Staff  
Join Date: Nov 2008
Last Activity: 22 September 2017, 12:47 AM EDT
Location: Amsterdam
Posts: 11,534
Thanks: 500
Thanked 3,335 Times in 2,943 Posts

find -L . -type f -name '*dat*' -exec ls -tr {} + | sed 's|.*/||'

Sponsored Links

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Error when connecting to remote server to find files with timestamp today's day digioleg54 Shell Programming and Scripting 1 04-11-2017 01:48 PM
Sort the files on their name and then the timestamp using Perl unankix Programming 12 05-15-2012 01:00 PM
sort the files based on timestamp and execute sorted files in order saidutta123 Shell Programming and Scripting 1 09-18-2011 02:47 PM
Shell script which will sort all the files in a directory with the timestamp they were created asappidi UNIX for Dummies Questions & Answers 6 07-18-2010 12:42 PM
Find files older then today & display with timestamp info kedar.mehta Shell Programming and Scripting 2 01-02-2009 02:21 PM

All times are GMT -4. The time now is 02:23 AM.