Replace string in files recursively
Find files containing text, then replace in-place
grep -rl 'old_string' /etc/ | xargs sed -i 's/old_string/new_string/g'
More linux commands
-
awk '{print $1, $3}' /etc/passwdPrint 1st and 3rd fields of a space-delimited file
-
awk '{sum += $2} END {print sum}' file.txtSum values in column 2 of a text file
-
sed -i '/^#/d' config.confRemove all comment lines starting with #
-
sed -n '/START/,/END/p' file.txtPrint block of text between START and END markers
-
sort file.txt | uniq -c | sort -rnCount occurrences of each unique line