- 论坛徽章:
- 0
|
[root@PANTA-Mtools study]# cat lists
CustomerSet.CUSTOMER_PAIR_UNUSED=2
CustomerSet.LOGOUT_SET_RADIO_DEFAULT=0
CustomerSet.LOGOUT_SET_TIME_DEFAULT=60
CustomerSet.CHART_DEFAULT_TYPE=USD/JPY#1#100_Customer
--------------------------------------------------------------
[root@PANTA-Mtools study]# sed -e '1,/^$/{/^$/d}' lists
CustomerSet.CUSTOMER_PAIR_UNUSED=2
CustomerSet.LOGOUT_SET_RADIO_DEFAULT=0
CustomerSet.LOGOUT_SET_TIME_DEFAULT=60
CustomerSet.CHART_DEFAULT_TYPE=USD/JPY#1#100_Customer
sed -e '1,/^$/{/^$/d}' lists 本意是取出文件第1行到空行之间的所有行,例如结果为A,
然后是分组命令{/^$/d},我对其的理解是在结果A的基础上再去掉空行,不知道这样理解的对不对。
要是按我的理解,
A为
CustomerSet.CUSTOMER_PAIR_UNUSED=2
CustomerSet.LOGOUT_SET_RADIO_DEFAULT=0
CustomerSet.LOGOUT_SET_TIME_DEFAULT=60
空行xxxxxxxxxxxxxxxxx
执行分组命令{/^$/d}后,结果应用
CustomerSet.CUSTOMER_PAIR_UNUSED=2
CustomerSet.LOGOUT_SET_RADIO_DEFAULT=0
CustomerSet.LOGOUT_SET_TIME_DEFAULT=60
可为什么实际结果为下面这个呢? 最后一行不是不在匹配模式中吗?为什么没有去掉?请高手解惑!
CustomerSet.CUSTOMER_PAIR_UNUSED=2
CustomerSet.LOGOUT_SET_RADIO_DEFAULT=0
CustomerSet.LOGOUT_SET_TIME_DEFAULT=60
CustomerSet.CHART_DEFAULT_TYPE=USD/JPY#1#100_Customer |
|