My output file is as below:
judi#cat file ---ABC--- word1 word2 word3 word4 word5 word6 ---end_ABC--- ---DEF--- line1 line2 line3 line4 ---end_DEF--- judi# I need to remove the lines in between the pattern ABC and end_ABC (inclusive the pattern, then replace with new content; the new content is in a file).
The content of the file varies, so I need to use only the pattern.
judi#file1 ---ABC--- wordA1 wordA2 wordA3 ---end_ABC--- judi# Desired result has to be
judi# ---ABC--- wordA1 wordA2 wordA3 ---end_ABC--- ---DEF--- line1 line2 line3 line4 ---end_DEF--- judi# I tried this command:
sed '/ABC/,/end_ABC/{/ABC/!{/end_ABC/!d}}' file > file 2 But I get this error:
sed: command garbled: /ABC/,/end_ABC/{/ABC/!{/end_ABC/!d}}
}-->;}.