FG
💻 Software

Search for a text pattern in linux

Fresh5 days ago
Mar 15, 20267186 views
Confidence Score0%
0%

Problem

I'm a linux newbie. I need to search for a string "teststring" in all *.java files coming under /home/user1/ (including subfolders). How can I do it in linux via shell command.

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Search for a text pattern in linux

Low Risk

The easiest way is to use GNU grep's features: If you're ever on another unix variant that doesn't have GNU grep, here's a portable way:

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment