awk怎么从文本文件读取某一段文本
请教:我想从test234.sql文本文件中,用awk读取从-- Table structure for table `fruits`开始,到-- Table structure for table `orderitems`结束的文本内容,输入到一个新的test1.sql文本文件。如何实现?
test234.sql如下:
-- Table structure for table `fruits`
--
DROP TABLE IF EXISTS `fruits`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `fruits` (
`f_id` char(10) NOT NULL,
`s_id` int(11) NOT NULL,
`f_name` char(255) NOT NULL,
`f_price` decimal(8,2) NOT NULL,
PRIMARY KEY (`f_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `fruits`
--
LOCK TABLES `fruits` WRITE;
/*!40000 ALTER TABLE `fruits` DISABLE KEYS */;
INSERT INTO `fruits` VALUES ('a1',101,'apple',5.20),('a2',103,'apricot',2.20),('a3',101,'pineapple',5.20),('b1',101,'blackberry',10.20),('b2',104,'berry',7.60),('b5',107,'xxxx',3.60),('bs1',10
2,'orange',11.20),('bs2',105,'melon',8.20),('c0',101,'cherry',3.20),('l2',104,'lemon',6.40),('m1',106,'mango',15.60),('m2',105,'xbabay',2.60),('m3',105,'xxtt',11.60),('o2',103,'coconut',9.20),
('t1',102,'banana',10.30),('t2',102,'grape',5.30),('t4',107,'xbababa',3.60);
/*!40000 ALTER TABLE `fruits` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `orderitems`
--