I have a file try.txt that looks like this:
(SOME_PRINT): [a] content
(SOME_PRINT): [a] [b] content
If I have this pattern in the beginning of a line in the file: (SOME_PRINT): [<word>] (where <word> is a combination of letters and numbers only), so I would like to replace it with (OTHER_PRINT):.
For the file above, I would like to find a command that its execution will make the file become:
(OTHER_PRINT): content
(OTHER_PRINT): [b] content
I tried to run sed -r -i 's/^\(SOME_PRINT\)\: \[.*\] /\(OTHER_PRINT\)\: /' try.txt , and got this output:
(OTHER_PRINT): content
(OTHER_PRINT): content
Can you explain why has [b] disappeared?