3

I'm trying to display on a Unix system recursively all the files that start with an a or ends with an a with some info about them: name, size and last modified.

I tried find . -name "*a" -o -name "a*" and it displays all the files okay but when I add -printf "%p %s" it displays only one result.

Chris Seymour
  • 83,387
  • 30
  • 160
  • 202

2 Answers2

4

If you want the same action to apply to both patterns, you need to group them with parentheses. Also, you should add a newline to printf, otherwise all of the output will be on one line:

find . \( -name "*a" -o -name "a*" \) -printf "%p %s\n"
Thor
  • 45,082
  • 11
  • 119
  • 130
0
find . -name "*.c" -o -name "*.hh" | xargs ls -l | awk '{print $9,$6,$7,$8,$5}'
Vijay
  • 65,327
  • 90
  • 227
  • 319