Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 23rd European Conference Adbis 2019 Bled Slovenia September 8 11 2019 Proceedings Lncs 11695

Authors: Tatjana Welzer ,Johann Eder ,Vili Podgorelec ,Aida Kamisalic Latific

1st Edition

3030287297, 978-3030287290

More Books

Students also viewed these Databases questions