Answers for "bash use cat in sed command"

1

bash use cat in sed command

# Basic syntax:
sed 's/<search_text>/'"`cat replacement.txt`"'/' your_file
# Where:
#	- The replacement.txt file contains a single line that will be used
#		to replace the search_text, where found in your_file. 
# Note, this isn't very useful unless combined with other functions like
#		find exec, e.g.:
find *.txt -exec sed -i 's/search_text/'"`cat replacement.txt`"'/' {} \;
Posted by: Guest on July-22-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language