Replace Text in the middle of string with wild character
"KRiTs" <[email protected]>
| Newsgroups | gmane.editors.sed.user |
|---|---|
| Message-ID | <[email protected]> |
Hi All Need urgent help with this I have large file which has following lines <SHOUT DEST="ECS" MESSAGE="JOBNAME HAS ENDED NOTOK" URGENCY="R" WHEN="NOTOK"/> Now I want append a word after MESSAGE=" with a condition that the line ends with WHEN="NOTOK"/> as there are other lines ending with WHEN="OK"/> which should not be touched. Challenge is the actual text within MESSAGE "" would vary ------------------------------------------------------------------------i tried sed with start and stop pattern but it turn on the flag and replaces even the other lines as for those also the start string is same. ---------------------------------------------------------------------- I tried \1 \2 option also but to no avail. Basically i want to have wild cad in the middle of string, have constant start and end strings and only if the start and end string matches replacement should happen in the middle. Thanks