Skip to main content
Tweeted twitter.com/StackUnix/status/1037038243001389057
edited tags
Link
Siva
  • 9.3k
  • 9
  • 60
  • 88
deleted 2 characters in body
Source Link
Siva
  • 9.3k
  • 9
  • 60
  • 88

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 remplacereplace the ',' by ')' in the line justejust 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 ); 

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 remplace the ',' by ')' in the line juste 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 ); 

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 ); 
Source Link
Mike
  • 73
  • 1
  • 6

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 remplace the ',' by ')' in the line juste 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 );