Reputation:
my file contains uneven comments:
// file1.php
// Week 4
// Quiz
//coment3
// comment4
/ /comment5
/ /comment6
%comment7
% comment8
%comment9
#comment10
# comment11
#comment12
I want to make these comments consistent by replacing #
or //
with just //
followed by a single space.
I have: s/[ \t]*//
.
it gives me
// file1.php
// Week 4
// Quiz
//coment3
// comment4
/ /comment5
/ /comment6
#comment10
# comment11
#comment12
Upvotes: 0
Views: 105
Reputation: 10445
sed -e 's,/[[:space:]]*/,//,' -e 's,[[:space:]]*//[[:space:]]*,// ,' -e 's/[[:space:]]*\([%#]\)[[:space:]]*/\1 /'
Upvotes: 1