Need help with your Discussion

Get a timely done, PLAGIARISM-FREE paper
from our highly-qualified writers!

glass
pen
clip
papers
heaphones

Write a bash program to calculate quintiles from a CSV (comma separated value) file.

Write a bash program to calculate quintiles from a CSV (comma separated value) file.

Write a bash program to calculate quintiles from a CSV (comma separated value) file.

Question Description

Bash Program

Write a bash program to calculate quintiles from a CSV (comma separated value) file.

Read the input lines:
the 1st and 2nd fields may contain text or integers
the 3rd (last) field will contain only integers
calculate the quintiles from lines where the 3rd field is present
the 1st quintile is the set of numbers smaller than 80% of all the numbers
the 2nd quintile is the set of numbers larger than 20% and smaller than 60% of all the numbers
the 3rd quintile is the set of numbers larger than 40% and smaller than 40% of all the numbers
the 4th quintile is the set of numbers larger than 60% and smaller than 20% of all the numbers
the 5th quintile is the set of numbers larger than 80% of all the numbers
For each input line output the following:
print the 1st, 2nd, and 3rd fields with no changes
if the 3rd field is present then print the quintile
separate output fields with commas
Example usage:
cat input-file | bash script.bash
Example input lines:
Title
a,b,6
c,d,2
e,f,15
g,h,90
i,j,9
k,l,1
m,n,4
o,p,30
q,r,1
foo,bar,3
Example output lines:
Title
a,b,6,3
c,d,2,2
e,f,15,4
g,h,90,5
i,j,9,4
k,l,1,1
m,n,4,3
o,p,30,5
q,r,1,1
foo,bar,3,2

Approximation

If the number of lines with 3rd field present is not divisible by 5:
the number of lines in the five quintiles will differ but that difference should not be more than 1
e.g. for 42 lines 8,8,9,8,9 is OK but 8,8,8,8,10 is not

Requirements

Use only bash and standard UNIX utilities:
do not use awk or other UNIX programming languages
Read from standard input, write to standard output:
do not use disk files for input or output
do not use command line parameters
output only processed input lines – no prompts, instructions, etc.

Documentation

Comments
include name, date, assignment
include brief instructions for using the program
include brief explanations of algorithms
include brief explanations of data structures
Use descriptive names for variables and functions.
Use a consistent style to indent code blocks.

Due Date

This assignment is due May 07 at 11:59 PM.
Email your program (where script.bash is the name of your file) with this command:
mail -s 'assignment' stuart < <em>script.bash</em>

Hints

Start early, this may take longer than you expect.
Think about the structure of your data and logic before you write any code.
With each revision add the smallest possible amount of code:
test your code with a variety of inputs
add comments as necessary
save your code with another name

Q&A on Assignment

Can I use the bc utility in Assignment ?
No, it’s a programming language. The man page says bc “is a language that supports arbitrary precision numbers with interactive execution of statements.”

Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."

Order Solution Now

Our Service Charter


1. Professional & Expert Writers: Eminence Papers only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed of papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by Eminence Papers are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Eminence Papers are known for the timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit in all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At Eminence Papers, we have put in place a team of experts who answer all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.

We Can Write It for You! Enjoy 20% OFF on This Order. Use Code SAVE20

Stuck with your Assignment?

Enjoy 20% OFF Today
Use code SAVE20