Question: for this assignment you will use you sed and bash to create a program for formatting C code bash will only be used to the

for this assignment you will use you sed and bash to create a program for formatting C code bash will only be used to the extent that it will run your script, using the sed command supplying it with the name of the input about testing on the command line. your program should only take a source code file as input and apply the following format/content rules
- no more than one space between tokens
- no trailing whitespsce after a line
- binary operators should always be surrounded by a single white space on wither side (including assignment and boolean). only the following operaotrs must be accounted for: +,-,*,/,=,==,=,.
- conditions should not have whitespace immediately inside of the parenthesis
- comments should be left alone. you may assume comments (single and multiline) do not appear on lines with source code.
This requirements requires the use on ONLY sed and bash. do not use python, awk, or any other programming languages, utlities,commands.
A sample input file and output file is provided to show what your code should look like after your script is invoked. for this assignment you will use you sed and bash to create
a program for formatting C code bash will only be used to

Hint: All of the above will NOT be performed in a single pass. This assignment requires the use of only sed and bash. Do not use awk, Python, or any other languages/utilities/commands. Example In the code below, underscores (_) represent spaces. Note that there are no changes to comments or \#include lines. Input (inputProgram.c): author: some_student **1 int_main()_\{ int_numberin; printf("Enter_a_number:_"); scanf ("\%d",_zumberIn); if_(_number In >n10){ /l____ add__two return_numberIn_+_ _; subtract_two return rumberin nu; 2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!