我的example.css
包含
http://www.example.com
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/* // http:// .cke_reset{margin:0;padding:0;border:0;background:transparent;text-decoration:none;width:auto;height:auto;vertical-
/*
*Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
*For licensing, see LICENSE.html or http://zoelabs.com/license
http://www.example3.com
*Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
*For licensing, see LICENSE.html or http://zoelabs.com/license
*/
http://www.example2.com
我已成功使用反转匹配来过滤/*
和*/
之间的字符串
这是我的bash输出:
/ ZoeLabs / - [ moono ] > sed -n '/\/\*/,/\*\//!p' example.css
http://www.example.com
http://www.example2.com/ ZoeLabs / - [ moono ] >
我希望输出
/ ZoeLabs / - [ moono ] > sed -n '/\/\*/,/\*\//!p' example.css
http://www.example.com
http://www.example2.com
/ ZoeLabs / - [ moono ] >
但是,为什么sed
在newline
之类的匹配模式之后没有追加awk
呢?
我该怎么做才能追加它?
答案 0 :(得分:1)
sed ':a;$!N;$!ba;s/\/\*[^*]*\*\([^/*][^*]*\*\|\*\)*\///g' example.css|awk '{print}'