Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 2. (20 marks) Write a well structured Bash script which deletes all the standard comments remarks from a C program. A standard comment line
Question 2. (20 marks) Write a well structured Bash script which deletes all the standard comments remarks from a C program. A standard comment line in C programs starts with the two-characters token () and ends with the two-characters token ) You may assume that each standard comment line contains the start and end tokens without any other statements before and after. Below is a snippet of C program: / a comment line in a C program * printf("It is /s NOT a comment line "); x 5; This is an assignment, not a comment line [TAB][SPACE] another empty comment line here ?another weird line, but not a comment line */ y-0; You can test your Bash script on the snippet of C program which contain all above four lines. The expected out from your script should look like printf("It is /x NOT a comment line */ "); x-5; /* This is an assignment, not a comment line ?another weird line, but not a comment line */ y-0; Note:. where [TABI[SPACES] denote there are some TAB key or white spaces in front of the line 2. Your script should read inputs from a text file, and write outputs into another file, and all the I O file names must be given in the command-line. 3. Linux utility sed is recommended to use in your script. Question 2. (20 marks) Write a well structured Bash script which deletes all the standard comments remarks from a C program. A standard comment line in C programs starts with the two-characters token () and ends with the two-characters token ) You may assume that each standard comment line contains the start and end tokens without any other statements before and after. Below is a snippet of C program: / a comment line in a C program * printf("It is /s NOT a comment line "); x 5; This is an assignment, not a comment line [TAB][SPACE] another empty comment line here ?another weird line, but not a comment line */ y-0; You can test your Bash script on the snippet of C program which contain all above four lines. The expected out from your script should look like printf("It is /x NOT a comment line */ "); x-5; /* This is an assignment, not a comment line ?another weird line, but not a comment line */ y-0; Note:. where [TABI[SPACES] denote there are some TAB key or white spaces in front of the line 2. Your script should read inputs from a text file, and write outputs into another file, and all the I O file names must be given in the command-line. 3. Linux utility sed is recommended to use in your script
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started