解开Java清单文件fin bash [英] Unwrapping a java manifest file fin bash
本文介绍了解开Java清单文件fin bash的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Java中,META-INF/MANIFEST.MF文件具有最大行长.除此之外,还会插入自动换行符,并在下一行的开头用空格表示,如下所示:
In Java, META-INF/MANIFEST.MF files have a maximum line length. Beyond that, an automatic line break is inserted, signaled by a space at the beginning of the next line, like so:
Manifest-Version: 1.0
Export-Package: com.google.common.net;uses:="com.google.common.base,ja
vax.annotation[file continues]
Bundle-Name: Guava: Google Core Libraries for Java
不幸的是,这使bash中的grep
和sed
痛苦不堪.
Unfortunately, this makes it painful to grep
and sed
in bash.
您将如何使用bash将其包装到其中?
How would you go about unwrapping it, using bash, into this?
Manifest-Version: 1.0
Export-Package: com.google.common.net;uses:="com.google.common.base,javax.annotation[file continues]
Bundle-Name: Guava: Google Core Libraries for Java
我会尝试sed
,但是它只能在每行的基础上工作,而且我也无法使tr
正常工作.
I'd try sed
, but it works only on a per line basis, and I can't get tr
to work properly either.
谢谢!
推荐答案
尝试使用此Perl单行代码:
Try this Perl one-liner:
$ perl -0777 -wpe 's/\n //g' MANIFEST.MF
它会删除每个换行符的实例,后跟一个空格.
It removes every instance of a line-break followed by a space.
这篇关于解开Java清单文件fin bash的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文