sed删除不包含指定单词的行

Table of Contents
问题:有个文件名为file,内容如下,
 

ACCTWARROOM.JFJ_JSPFP_FILL T accTwarRoom.uut_jjfJ_JJJF_OWPERP  

ACC
T ACCTWARROOM.JJ_POLL_JIM L

TTT
acctwarroom.jj_pq_jjjj_ppp t
aipindictment

要求:删除不包含单词acctwarroom的行(不区分单词的大小写)

-----------------------------------------------------------------------------------------------------------------------
答案:
 
方法1  先将所有字母的小写转换为大写格式,再打印包含指定单词的行。
 
[pc@iZj6cj7qz0pp3b2plfmewiZ ~]$ sed -n  -e 's@[a-z]@\u&@g ; /ACCTWARROOM/p' file
ACCTWARROOM.JFJ_JSPFP_FILL T ACCTWARROOM.UUT_JJFJ_JJJF_OWPERP  
T ACCTWARROOM.JJ_POLL_JIM L
ACCTWARROOM.JJ_PQ_JJJJ_PPP T
 
方法2  先将所有字母转为小写,再删除不包含指定单词的行
 
[pc@iZj6cj7qz0pp3b2plfmewiZ ~]$ cat file | sed -e 's@[A-Z]@\l&@g ; /\<acctwarroom\>/ !d'
acctwarroom.jfj_jspfp_fill t acctwarroom.uut_jjfj_jjjf_owperp  
t acctwarroom.jj_poll_jim l
acctwarroom.jj_pq_jjjj_ppp t