0
已知以下文件:从Python文件中删除任意一行文本?
host wallmount {
option root-path "iscsi:10.0.0.202::::iqn.2012-01.com.enactpc:storage.wall_mount";
hardware ethernet 00:15:c5:71:b9:68;
}
host netbook {
option root-path "iscsi:10.0.0.202::::iqn.2012-01.com.enactpc:storage.netbook";
hardware ethernet 00:21:70:bb:4e:95;
}
host laptop {
option root-path "iscsi:10.0.0.202::::iqn.2012-01.com.enactpc:storage.laptop";
hardware ethernet 00:1b:38:4c:62:40;
}
是否可以采取已知的“主机名”(如“壁挂式”),并删除它自动的整个申报?
P.S.这是在Linux下的DHCP配置文件...我不知道这是否有帮助。
当然,这是可能的。真正的问题是你想要它与你想要的代码的多么简单。例如:它应该处理嵌套大括号?大括号可以用引号括起来吗?密封大括号总是有自己的一行吗? –
将来可能会嵌套大括号,但现在,“sed”示例将起作用... – Soviero