Description
(1) create a sed script which makes all comments consistent.
Comment lines begin with either “//” or “#” and can have any number of whitespaces before and after the “//” or “#”. Replace these comment lines with only “//” followed by a single space and the rest of the original comment. Finally, remove any lines that begin with a “%”. Include the command to run the script for a file named file1.php (contents below) and print output to file1Clean.php.
Before Comment Fixes:
// file1.php
// Week 4 // Quiz
//comment3
// comment4
/ /comment5
/ /comment6
%comment7
% comment8
%comment9
#comment10
# comment11
#comment12
<?php
# print something echo “hello world”;
# close php tag
?>
% this isn’t a correct comment
After Comment Fixes:
// file1.php
// Week 4
// Quiz
// comment3 // comment4
/ /comment5
/ /comment6
%comment9
// comment10
// comment11
// comment12
<?php
// print something echo “hello world”;
// close php tag
?>
Reviews
There are no reviews yet.