FG

grep all .java files in a directory for a particular string

Fresh3 days ago
Mar 15, 202620908 views
Confidence Score0%
0%

Problem

How would I search all .java files for a simple string (not a regex) in the current directory and all sub-directories on Mac OS X? I just want to print a list of file and directory names that match.

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: grep all .java files in a directory for a particular string

Low Risk

And the always popular EDIT (by Frank Szczerba): If you are dealing with filenames or directories that have spaces in them, the safest way to do this is: There's always more than one way to do it.

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment