I have been trying to use sed for the following - I am searching in a file for the below keyword -
</Remote>
And right after it, on new line, am trying to insert following -
<ScanConfig filesToTest="ABCD_*.csv" namePatternLogic="0" scanMethod="0" subdirsScanLevel="" />
I have tried standard SED -
sed -i '</Remote>/a <ScanConfig filesToTest="ABCD_*.csv" namePatternLogic="0" scanMethod="0" subdirsScanLevel="" />' somefile.txt
OR
sed -i '\#^ *</Remote> *$# a\ <ScanConfig filesToTest="ABCD_*.csv" namePatternLogic="0" scanMethod="0" subdirsScanLevel="" />' somefile.txt
Both failed with below errors -
sed: -e expression #1, char 1: unknown command: `<'
sed: -e expression #1, char 1: unknown command: `"'
I suspect the special characters in the line I am trying to insert which has <, /> characters is confusing SED. I tried to use escape characters with /\ though it didn't quiet work out.
Can someone please help me with this? Thanks.