将以下三行并为一行,并用,号分隔。
mail:
mailQuota:
userPassword:: c2VjcmV0
mail:
mailQuota:
userPassword:: c2VjcmV0
mail:
mailQuota: 10000
userPassword:: e2NyeXB0fWhDM21NNm1zQUtBUXc=
mail:
mailQuota: 10000
userPassword:: e2NyeXB0fUtuQW50NEx6TS4zRG8=
mail:
mailQuota: 50000
userPassword:: e2NyeXB0fUtuLmVpUTNDTkNUeTI=
方法一:
awk '{if (NR%3==0) {print} else {printf "%s,",$0}}' aaa
mail: : ,userPassword:: c2VjcmV0
mail: : ,userPassword:: c2VjcmV0
mail: : 10000,userPassword:: e2NyeXB0fWhDM21NNm1zQUtBUXc=
mail: : 10000,userPassword:: e2NyeXB0fUtuQW50NEx6TS4zRG8=
mail: : 50000,userPassword:: e2NyeXB0fUtuLmVpUTNDTkNUeTI=
方法2:
sed '/mail:/ !N;s/\n/, /' user.txt | sed '$!N;s/\n/, /'
结果如下:
mail: , mailQuota: , userPassword:: c2VjcmV0
mail: , mailQuota: , userPassword:: c2VjcmV0
mail: , mailQuota: 10000, userPassword:: e2NyeXB0fWhDM21NNm1zQUtBUXc=
mail: , mailQuota: 10000, userPassword:: e2NyeXB0fUtuQW50NEx6TS4zRG8=
mail: , mailQuota: 50000, userPassword:: e2NyeXB0fUtuLmVpUTNDTkNUeTI=
mail: , mailQuota: 10000, userPassword:: e2NyeXB0fXdWN25HdFAzVHlQU2M=
方法3:
ultraedit32下记录宏和执行宏。
阅读(748) | 评论(0) | 转发(0) |