here is the contents of bigfile.sql
CREATE TABLE `Table11` (
`id` int(11) NOT NULL ,
`entityName` enum('Lines','EndUsers') COLLATE utf8_unicode_ci NOT NULL,
`parentAllianceMigrationProjectId` varchar(255) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=2000 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `Table22` (
`empNo` int(13) NOT NULL AUTO_INCREMENT,
`channels` enum('one','two','three') COLLATE utf8_unicode_ci NOT NULL,
`reserved6` varchar(255),
`accountStatus` enum('Active','Locked','Expired','Deactivated') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'Active',
PRIMARY KEY (`empno`)
) ENGINE=InnoDB AUTO_INCREMENT=2000 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `HOOOP` (
`allianceSiteId` int(11) DEFAULT NULL,
`trunkGroupsId` int(11) DEFAULT NULL,
`lastModified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
UNIQUE KEY `allianceSiteId` (`allianceSiteId`,`trunkGroupsId`)
) ENGINE=InnoDB AUTO_INCREMENT=2000 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `Table33` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`allianceId` int(11) NOT NULL,
`migratedAt` datetime DEFAULT NULL,
`migrationDetail` text COLLATE utf8_unicode_ci,
`unigyId` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2000 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
here is the content of tmpfile.sql
CREATE TABLE `HOOOP` (
`allianceSiteId` int(11) DEFAULT NULL,
`trunkGroupsId` int(11) DEFAULT NULL,
`lastModified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
UNIQUE KEY `allianceSiteId` (`allianceSiteId`,`trunkGroupsId`)
)
this tmpfile.sql is extracted contents from bigfile.sql... now what i want to do is delete these extracted content from main file that is bigfile.sql... this i want to do dynamically.. but for explaining purpose lets say we have
firstword : CREATE TABLE `AllianceSiteTrunkGroupTrunkGroupsMap` (
lastword : ) ENGINE=InnoDB AUTO_INCREMENT=2000 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
where firstword and lastword are the first and last line of the tmpfile.sql.. ofcourse the last line of tmpfile.sql has only ")" but i am appending "ENGINE=InnoDB AUTO........etc etc" to identify since main file (bigfile) has this.
i tried
sed '/"firstword"/,/""lastword/d' bigfile.sql
but this is not working.... can anyone help me... :wall::wall::wall:
---------- Post updated at 02:53 PM ---------- Previous update was at 02:50 PM ----------
spell mistale its this which i tried..
sed '/"$firstword"/,/"$lastword"/d' bigfile.sql