我的文件中包含了不均衡的评论:
// file1.php
// Week 4
// Quiz
//coment3
// comment4
/ /comment5
/ /comment6
%comment7
% comment8
%comment9
#comment10
# comment11
#comment12我想让这些评论保持一致,将#或//替换为只使用//,后面只有一个空格。
我有:s/[ \t]*//。
它给了我
// file1.php
// Week 4
// Quiz
//coment3
// comment4
/ /comment5
/ /comment6
#comment10
# comment11
#comment12发布于 2020-09-28 03:01:06
sed -e 's,/[[:space:]]*/,//,' -e 's,[[:space:]]*//[[:space:]]*,// ,' -e 's/[[:space:]]*\([%#]\)[[:space:]]*/\1 /'https://stackoverflow.com/questions/64095348
复制相似问题