我有各种类型的文件php html xml
,其中copyright
通知包含在top
或顶部2-3行之后
/**
* Copyright (c) 2014
* All rights reserved.
* bla bla many lines like this
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
现在我要从所有文件中删除所有文本。
如何使用sed删除。
我只知道基本sed
,但我不知道如何处理多线
答案 0 :(得分:3)
$ cat file
1
2
/**
* Copyright (c) 2014
* All rights reserved.
* bla bla many lines like this
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
3
4
/* and here is another comment
* you presumably want to keep
*/
5
6
$ awk '/^\/\*/{c++} c!=1; /^ \*\//{c++}' file
1
2
3
4
/* and here is another comment
* you presumably want to keep
*/
5
6
答案 1 :(得分:2)