FG

find and replace command for whole directory

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

Problem

Is there any command in Linux which will find a particular word in all the files in a given directory and the folders below and replace it with a new word?

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: find and replace command for whole directory

Low Risk

You can use the following command: It uses to find files containing the string "foo" and then invokes sed to replace "foo" with "bar" in them. As a result, only those files containing "foo" are modified. The rest of the files are not touched.

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment