Skip to main content
2 of 3
deleted 2 characters in body
Siva
  • 9.3k
  • 9
  • 60
  • 88

Replace a string before a certain line

I have one file like:

ID_SOUR_CALENDAR BIGINT NOT NULL DEFAULT 0 COMPRESS 0 , UNIQUE PRIMARY INDEX ( CALENDAR_DATE ); ID , ID_SOUR , PRIMARY INDEX ( CALENDAR_DATE ); 

I want to replace the ',' by ')' in the line just before the line containing PRIMARY.

The result should be:

ID_SOUR_CALENDAR BIGINT NOT NULL DEFAULT 0 COMPRESS 0 ) UNIQUE PRIMARY INDEX ( CALENDAR_DATE ); ID , ID_SOUR ) PRIMARY INDEX ( CALENDAR_DATE ); 
Mike
  • 73
  • 1
  • 6