Issue with replace

Hi,
I have a problem with a replace of a pattern in a file.

Example of file:
CREATE TABLE TEST.TEST
(
ID_SOGGETTO BIGINT NOT NULL,
ENTE VARCHAR(64))
UNIQUE PRIMARY INDEX ( ID_SOGGETTO ,ENTE );

I want to replace the red pattern with another text:
i want to replace the text after the character ")" at the end of line up to the ";" character.
The file contain multiple CREATE TABLE statements.
I tryed with sed command..

Thanks
Marco

Red pattern is missing in your post. Also can you add code tags.

Sorry

CREATE TABLE TEST.TEST
(
ID_SOGGETTO BIGINT NOT NULL,
ENTE VARCHAR(64))
UNIQUE PRIMARY INDEX ( ID_SOGGETTO ,ENTE );

sed 's#.*);#replace string#' file

There may be multiple rows between the first line end with ")" and ";"

CREATE TABLE TEST.TEST 
(
ID_SOGGETTO BIGINT NOT NULL,
ENTE VARCHAR(64))
INDEX ( ENTE )
UNIQUE PRIMARY INDEX ( ID_SOGGETTO ,ENTE );

Please use code tags as required by forum rules!

Your specification is very vague. Will the last line of your CREATE TABLE statement always be a one single index definition? And, there is nothing (= empty string) between ")" and ";" in your sample, unless you are talking of the previous line's ")", which cannot be considered in line based tools like awk or sed.

Applying a wild guess, I'd propose sth like

sed 's/^.*);/replacement;/' file

If that does not suit you, please be way more specific, providing a desired output sample.

EDIT: obviously we are NOT talking of single index definitions. And, I'd bet, the replacemant text will not be constant but vary from table definition to table definition...

$
$ cat -n f84
     1  CREATE TABLE TEST.TEST1
     2  (
     3  ID_SOGGETTO BIGINT NOT NULL,
     4  ENTE VARCHAR(64))
     5  UNIQUE PRIMARY INDEX ( ID_SOGGETTO ,ENTE );
     6
     7  CREATE TABLE TEST.TEST2
     8  (
     9  ID_SOGGETTO BIGINT NOT NULL,
    10  ENTE VARCHAR(64))
    11  INDEX ( ENTE )
    12  UNIQUE PRIMARY INDEX ( ID_SOGGETTO ,ENTE );
    13
$
$
$ perl -lne 'BEGIN {undef $/; $rpl="REPLACEMENT_TEXT_HERE"} while(/(^CREATE.*?\(.*?\)$)(.*?\);)/msg){print "$1\n$rpl\n"}' f84
CREATE TABLE TEST.TEST1
(
ID_SOGGETTO BIGINT NOT NULL,
ENTE VARCHAR(64))
REPLACEMENT_TEXT_HERE
 
CREATE TABLE TEST.TEST2
(
ID_SOGGETTO BIGINT NOT NULL,
ENTE VARCHAR(64))
REPLACEMENT_TEXT_HERE
 
$
$