我有一个只有几行的文件。文件名 :test.sql
INSERT INTO ADJUSTMENT_REASON VALUES (17-MAY-18,,'','','','S','C','Y','N',,'Y','N','N','A','BAN','Y','B','Mobile Internet Discount','N','','','N','B','','','N','N','');
INSERT INTO ACTIVITY_REASON_TEXT VALUES ('ADJ','','','',17-MAY-18,'','','','Mobile Internet Discount','Mobile Internet Discount','Y','N','','A',,'',,'','','');
17-MAY-18
我想将文件每一行的日期替换为 SYSDATE。
答案1
sed 's/17-MAY-18/SYSDATE/g' <test.sql >new-test.sql
这将new-test.sql
使用内容创建
INSERT INTO ADJUSTMENT_REASON VALUES (SYSDATE,,'','','','S','C','Y','N',,'Y','N','N','A','BAN','Y','B','Mobile Internet Discount','N','','','N','B','','','N','N','');
INSERT INTO ACTIVITY_REASON_TEXT VALUES ('ADJ','','','',SYSDATE,'','','','Mobile Internet Discount','Mobile Internet Discount','Y','N','','A',,'',,'','','');