Is there any way to have ack
sort the results found by date of modification? (ideally showing the date next to the result?). It doesn't look like ack
has a date option, but just in case.
If this isn't possible with ack
, how about grep
or using a combination of tools?
Best Answer
Neither
ack
orgrep
have any notion of a file's modification dates. For that you'll need to generate the list of files first, and then sort them based on afterwards.You can use
xargs
to run the output of eitherack
orgrep
into another command which will provide the modification dates. For the modification dates you can usestat
to do that.Example
NOTE: This method will only show you the names of the files that matched your query along with the modification date.