0
我有很长的单行一些行的注释:转换长的单行注释成多短线
# this is a comment describing the function, let's pretend it's long.
function whatever()
{
# this is an explanation of something that happens in here.
do_something();
}
在这个例子中(它适应其他数字应该是微不足道的),我想
- 每行的最大数量为33个字符(每个凹口电平为4位)和
- 到在最后可能的空间
- 每个附加线被打破不被缩进EXAC像原始线一样。
所以它最终会看起来像这样:
# this is a comment describing
# the function, let's pretend
# it's long.
function whatever()
{
# this is an explanation of
# something that happens in
# here.
do_something();
}
我试图写一个脚本sed
,我试图寻找这样的(而忽略了试图使其在打破特定字符计数的清晰度和因为它没有工作):
s/\(^[^#]*# \)\(.*\) \(.*\)/\1\2\n\1\3/g;
这破坏了行只有一次,不重复像我错认为g
做(和它,如果它是在实际上会做或者其他什么)。