简体   繁体   中英

Why sed doesn't append newline like awk?

I have example.css which contains

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

I already success to filter string between /* and */ with invert-match
And here is my bash output :

/ ZoeLabs / - [ moono ] > sed -n '/\/\*/,/\*\//!p' example.css
http://www.example.com



http://www.example2.com/ ZoeLabs / - [ moono ] >  

I expect output will be

/ ZoeLabs / - [ moono ] > sed -n '/\/\*/,/\*\//!p' example.css
http://www.example.com



http://www.example2.com
/ ZoeLabs / - [ moono ] >

But, why sed doesn't append newline after matched pattern like awk do?
What should I do to append it?

sed ':a;$!N;$!ba;s/\/\*[^*]*\*\([^/*][^*]*\*\|\*\)*\///g' example.css|awk '{print}'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM