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..
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...