fork(2) download
  1. #!/bin/bash
  2. s="some KEY- text
  3. some text @@some-text-KEY-some-other-text@@
  4. text again @@some-text-KEY-some-other-text@@ @@some-text-KEY-some-other-text@@
  5. again @@some-text-KEY-some-other-text-KEY-text@@
  6. some text with KEY @@KEY-some-text@@
  7. blabla @@KEY@@"
  8.  
  9. sed ':A; s/\(@@[^@]*\)KEY-\([^@]*@@\)/\1VALUE-\2/g; tA' <<< "$s"
Success #stdin #stdout 0s 4268KB
stdin
Standard input is empty
stdout
some KEY- text
some text @@some-text-VALUE-some-other-text@@
text again @@some-text-VALUE-some-other-text@@ @@some-text-VALUE-some-other-text@@
again @@some-text-VALUE-some-other-text-VALUE-text@@
some text with KEY @@VALUE-some-text@@
blabla @@KEY@@