How to use SED to search and replace a string in multiple files in linux

You can use the SED linux command to search and replace a string within all files inside a directory:

This example replaces all occurrences of fast with slow in file names that end in .htm:

$ find ./* -name ‘*.htm*’ -type f -exec sed -i ‘s/fast/slow/g’ {} \;


Dual Run AC Capacitor 45+5 MFD µF 370-440VAC 50/60Hz 5% HVAC QUALITY GUARANTEED picture

Dual Run AC Capacitor 45+5 MFD µF 370-440VAC 50/60Hz 5% HVAC QUALITY GUARANTEED

$10.75



500pc Radial Electrolytic Capacitor Assortment Kit 24 Value 0.1uF-1000uF 10V-50V picture

500pc Radial Electrolytic Capacitor Assortment Kit 24 Value 0.1uF-1000uF 10V-50V

$14.92



Dual Run AC Capacitor 35+5 MFD µF 370-440VAC 50/60Hz 5% HVAC QUALITY GUARANTEED picture

Dual Run AC Capacitor 35+5 MFD µF 370-440VAC 50/60Hz 5% HVAC QUALITY GUARANTEED

$8.32



1uF to 470uF 12 Values x 10 Each Electrolytic Capacitor 120pc Assortment Kit picture

1uF to 470uF 12 Values x 10 Each Electrolytic Capacitor 120pc Assortment Kit

$5.49



Dual Run Capacitor 45+5 MFD/UF 450VAC AC Electric Motor HVAC PREMIUM QUALITY picture

Dual Run Capacitor 45+5 MFD/UF 450VAC AC Electric Motor HVAC PREMIUM QUALITY

$13.99



45+5 45/5 uF MFD 370-440 V VAC High Quality Motor Dual Run Capacitor CBB65-R  picture

45+5 45/5 uF MFD 370-440 V VAC High Quality Motor Dual Run Capacitor CBB65-R

$13.20



New 630v Film Capacitors for Tube Radio Repair .022 .01 .047 .1 .25 .033 .05 picture

New 630v Film Capacitors for Tube Radio Repair .022 .01 .047 .1 .25 .033 .05

$4.99



TEMCo 45+5 uf/MFD 370-440 VAC volts Round Dual Run Capacitor 50/60 Hz -Lot-1 picture

TEMCo 45+5 uf/MFD 370-440 VAC volts Round Dual Run Capacitor 50/60 Hz -Lot-1

$14.95



CSRU1 Compressor Saver Hard Start for 1 to 3 Ton Systems picture

CSRU1 Compressor Saver Hard Start for 1 to 3 Ton Systems

$19.99



MOTOR RUN CAPACITOR DUAL  40/5 MFD 370-440 VAC 50/60HZ picture

MOTOR RUN CAPACITOR DUAL 40/5 MFD 370-440 VAC 50/60HZ

$11.99



Powered by WordPress. Designed by WooThemes