shell script to find and replace text in a file code example
Example 1: how to find and replace a string in a file using shell script
sed -i 's/original_string/new_string/g' file_name.ext_name
Example 2: linux replace string in all files
sed -i 's/old-text/new-text/g' input.txt
Example 3: bash find and replace all files with specifc name with another file
find . -name "boom.txt" -exec cp ~/replace.txt {} \;
Example 4: bash search and replace text in file
awk '{gsub(regex, substitution_text, $field#); print $0;}' input_file
awk '{gsub(" ","",$0); print $0;}' input_file