-1

i want to do following action

for(File : find - ".java"){
// here i will do grep on the file, i want to process each file separetely
}

What is way to do this in bash?

user3569530
  • 193
  • 2
  • 4
  • 13

1 Answers1

2

Just use a process substitution:

while IFS= read -r name;
do
    # do things with $name, which contains the name of the file
done < <(find -type f -name "*.java")
Community
  • 1
  • 1
fedorqui
  • 275,237
  • 103
  • 548
  • 598