tags:

views:

69

answers:

2

I'm performing this grep: grep -l "Validation failed" *.dbg

This returns a file listing. However, I'm most interested in the times modified of these files.

What would the proper command be?

Edit: the argument in the title was wrong.

+3  A: 

xargs is my friend, apparently. The answer is: grep -l "Validation failed" *.dbg | xargs ls -ltr

GoingTharn
If you have GNU userland (e.g., GNU/Linux system), a more robust solution (which handles filenames with whitespace characters) is: grep -lZ "..." *.dbg | xargs -0 ls -ltr
Chris Jester-Young
A: 

You can also do it with

for file in `grep -l "Validation failed" *.dbg`; do ls -ltr $file; done

but xargs is definitely neater, shorter, and gives you easy delimiter options.

Andy