i all.
This one sounds so simple, but I can't get it to work. I need to delete lines with certain keywords from a file.
I have a file called defaultRules, with keywords:
IPSEC_AH
IKE_UDP
IPMP_TEST_IFACE2
Then, I have another file called rules.txt with some rules:
'344.','IPSEC_ESP','','','','','1.','0.','0.','0.','0.','5.','1.','Allow IPSec ESP Packets on all IP interfaces'
'345.','IPSEC_AH','','','','','1.','0.','0.','0.','0.','6.','1.','Allow IPSec AH Packets on all IP interfaces'
'346.','IKE_TCP','','','','','1.','500.','0.','0.','0.','3.','1.','Allow IKE Negotiation on all IP interfaces'
'347.','IKE_UDP','','','','','1.','500.','0.','0.','0.','2.','1.','Allow IKE Negotiation on all IP interfaces'
'348.','CLUSTER_IC_NODE1','clusternode1-priv','','','','1.','0.','0.','0.','0.','4.','1.','Allow cluster inter-connect packets from node 1'
'349.','CLUSTER_IC_NODE2','clusternode2-priv','','','','1.','0.','0.','0.','0.','4.','1.','Allow cluster inter-connect packets from node 2'
'350.','ICMP_NODE_IP','ipmp_node_alias','','','','1.','0.','0.','0.','0.','1.','1.','Allow ICMP to Node IP'
'351.','ICMP_BMS','ipmp_bms','','','','1.','0.','0.','0.','0.','1.','1.','Allow ICMP to BMS IP'
'352.','IPMP_TEST_IFACE1','ipmp_test_alias_1','','','','1.','0.','0.','0.','0.','1.','1.','Allow IPMP Test Packets on 1st test interface'
'353.','IPMP_TEST_IFACE2','ipmp_test_alias_2','','','','1.','0.','0.','0.','0.','1.','1.','Allow IPMP Test Packets on 2nd test interface'
The objective is to remove all lines in rules.txt that contain the keywords in defaultRules, so I tried this by first renaming the keywords to 'unused' and then removing all lines that contain 'unused':
for a in `cat defaultRules` ; do sed -e 's/$a/unused/' rules.txt | grep -v unused > rules.out ; done
It did nothing, rules.txt and rules.out are identical.
Any ideas?
Thanks in advance,
BRH