Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
File 使用sed使所有注释保持一致_File_Text_Sed - Fatal编程技术网

File 使用sed使所有注释保持一致

File 使用sed使所有注释保持一致,file,text,sed,File,Text,Sed,我的文件包含不均匀的注释: // file1.php // Week 4 // Quiz //coment3 // comment4 / /comment5 / /comment6 %comment7 % comment8 %comment9 #comment10 #

我的文件包含不均匀的注释:

// 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
sed -e 's,/[[:space:]]*/,//,' -e 's,[[:space:]]*//[[:space:]]*,// ,' -e 's/[[:space:]]*\([%#]\)[[:space:]]*/\1 /'