Using `sed` to find and replace in file
sed = Stream EDitor
sed find and replace text
sed 's/word1/word2/g' input.filesed 's/word1/word2/g' input.file > output.fileCan change delimiter / to something else:
/ to something else:sed 's~word1~word2~g' input.file > output.fileFind and replace in the line contains something
sed -i -e '/FOO/s/love/sick/' input.txtFind and replace multiple files in sub-folder
find ./ -type f -exec sed -i -e 's/apple/orange/g' {} \;PreviousMacOS's Touch ID on TerminalNextMerging contents of multiple .csv files into single .csv file
Last updated