[Solved] Find and replace till nth occurence of a special character

Hi,

I have a requirement to search for a pattern in each line in a file and remove the in between words till the 3rd occurrence of double quote (").

Ex: CREATE TABLE "SCHEMANAME"."AMS_LTV_STATUS"
(Note: "SCHEMANAME" may changes for different schemas. Its not a fixed value)

I need to remove whatever value comes starting from TABLE till the 3rd occurrence of "

The output should be:
CREATE TABLE "AMS_LTV_STATUS"

Thanks in Advance.

Cheers
Satya:b:

$ echo 'CREATE TABLE "SCHEMANAME"."AMS_LTV_STATUS" ' | sed "s/TABLE[^.]*./TABLE /"
CREATE TABLE "AMS_LTV_STATUS"

Thanks for the quick response. Its working fine.

Cheers,
Satya..