Skip to main content
Corrected the code
Source Link
Praveen Kumar BS
  • 5.3k
  • 2
  • 11
  • 16

Tested with sed command and worked fine

command:

  sed -r "s/^\s+//g" filename|sedfilename| sed '/^\/\*.*\*\/$/d'

output:

printf("It is /* Comment 2 */\n");
x = 5; /* Comment 3 */
/* Comment 5 */ y = 0;
/*
* Comment 6
*/
// Comment 7

Tested with sed command and worked fine

command:

sed -r "s/^\s+//g" filename|sed '/^\/\*.*\*\/$/d'

output:

printf("It is /* Comment 2 */\n");
x = 5; /* Comment 3 */
/* Comment 5 */ y = 0;

Tested with sed command and worked fine

command:

  sed -r "s/^\s+//g" filename| sed '/^\/\*.*\*\/$/d'

output:

printf("It is /* Comment 2 */\n");
x = 5; /* Comment 3 */
/* Comment 5 */ y = 0;
/*
* Comment 6
*/
// Comment 7
Removed the command from the output ; added 4 characters in body; added 1 character in body
Source Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 264

Tested with sed command and worked fine

command:sed -r "s/^\s+//g" filename|sed '/^\/\*.*\*\/$/d'

output

sed -r "s/^\s+//g" filename|sed '/^\/\*.*\*\/$/d' 

output:

printf("It is /* Comment 2 */\n");
x = 5; /* Comment 3 */
/* Comment 5 */ y = 0;

Tested with sed command and worked fine

command:sed -r "s/^\s+//g" filename|sed '/^\/\*.*\*\/$/d'

output

sed -r "s/^\s+//g" filename|sed '/^\/\*.*\*\/$/d' 
printf("It is /* Comment 2 */\n");
x = 5; /* Comment 3 */
/* Comment 5 */ y = 0;

Tested with sed command and worked fine

command:

sed -r "s/^\s+//g" filename|sed '/^\/\*.*\*\/$/d'

output:

printf("It is /* Comment 2 */\n");
x = 5; /* Comment 3 */
/* Comment 5 */ y = 0;
Source Link
Praveen Kumar BS
  • 5.3k
  • 2
  • 11
  • 16

Tested with sed command and worked fine

command:sed -r "s/^\s+//g" filename|sed '/^\/\*.*\*\/$/d'

output

sed -r "s/^\s+//g" filename|sed '/^\/\*.*\*\/$/d' 
printf("It is /* Comment 2 */\n");
x = 5; /* Comment 3 */
/* Comment 5 */ y = 0;