kos's answer already does the job. My answer only improves the regex somewhat.
By using the grouping pattern \( \)
and the escaped .\+
we can tell it to match the whole group **;
and whatever else is followed. In this example I am using
$ sed -e "s|\(\*\*;\).\+|TEST|g" stars.txt
TEST
*(Eng_Sen:This is an apple)TEST
TEST
TEST
*(Eng_Sen:This is an apple)TEST
TEST
Note that GNU sed
version can take any character as separator in the substitution command, not just /
. Here I was using vertical bar.
In the example above ,I've taken the liberty to increase the OP's example from 3 to 6 lines.
$ cat stars.txt
**;**;**;
*(Eng_Sen:This is an apple)*;*(WordID:1 2 3 4)*;*(message:)*;
**;**;**
**;**;**;
*(Eng_Sen:This is an apple)*;*(WordID:1 2 3 4)*;*(message:)*;
**;**;**
sed
in particular? Considering the particular characters involved, it would be hard to read in those patterns from a file or something.