如果存在特定单词,我想从所有行中删除该特定单词

如果存在特定单词,我想从所有行中删除该特定单词

例如:

CREATE VIEW AIPKEYITEM.SEASONGROUPNETSALES ( 
CALENDARID , 
PRODUCTGROUPID FOR COLUMN PRDGRPID   , 
NETSALESDOLLARS FOR COLUMN NETSA00001 , 
NETSALESUNITS FOR COLUMN NETSA00002 ) 
AS 
SELECT  
        (SELECT MIN(CALENDARID)  
            FROM AIPKEYITEM.KEYIT00002  
            WHERE FISCALYEAR = CAL.FISCALYEAR  
            AND FISCALSEASON = CAL.FISCALSEASON) CALENDARID  
    , PRODUCTGROUPID  
    , SUM(NETSALESDOLLARS) NETSALESDOLLARS  
    , SUM(NETSALESUNITS) NETSALESUNITS  
    FROM AIPKEYITEM.KEYIT00002 CAL  
    INNER JOIN AIPKEYITEM.WEEKG00001 WEEKGROUPORGUNITUNITSDOLLARS  
    ON CAL.CALENDARID = WEEKGROUPORGUNITUNITSDOLLARS.CALENDARID  
    GROUP BY CAL.FISCALYEAR, CAL.FISCALSEASON, PRODUCTGROUPID ; 

在上面的示例中,我想删除从 FOR COLUMN 所在行开始的整个单词。

答案1

怎么样:

cat myscript | sed 's/FOR COLUMN.*$//g' > myscript.filtered

myscript上面显示的文件名是什么时候?这是您希望实现的目标吗?

相关内容