I know that I sedcan add text in several ways:
add line NEW_TEXT:
sed -i '/PATTERN/ a NEW_TEXT' file
add file contents file_with_new_text:
sed -i '/PATTERN/ r file_with_new_text' file
However, is there a way to add text passed through sedvia stdout? I hope to get the equivalent:
sed 'XXX,YYY p' file1 > /tmp/file
sed -i 'ZZZ r /tmp/file' file2
without using a temporary file. Is it possible?
source
share