| Raw Input
| Word: cat!! An indicator is neither a cat nor a catalog, not related to a cat.
|
|
| Desired Output
| Word: !! An indicator is neither a nor a catalog, not related to a .
|
|
Description
- If a line has a word followed by `!!', delete all instances of that word.
- The following script only processes the word preceding the first `!!'.
- In the example, the word to be deleted is `cat'.
`catalog', `indicator' should be kept intact.
|
Script and Comments
Script1 [ 1] :loop
[ 2] s/\b((\w+)!!.*)\b\2\b/\1/
[ 3] t loop
[ 4] s/\b(\w+)!!/!!/
| |
|