Question
This is due by 3/9/2018 Thanks! Students will create a BASH shell script to process the data contained in an external file. The external file
This is due by 3/9/2018
Thanks!
Students will create a BASH shell script to process the data contained in an external file. The external file contains particle names and their momentums (one particle per line) collected during a particle accelerator test at CERN.
Write a BASH shell script that uses a combination of the Linux commands cat, cut, grep, numaverage, numbound, uniq, sort, and wc to summarize the data contained in an external file
Note: Students should use the man command to learn more about each of the above Linux commands.
The script should accept the name of the external file as a command-line argument
The script should display the total number of particles recorded in the file
The script should summarize the data of each unique particle (species):
Note 1: Do NOT create temporary files to store data - chain commands together with piping.
Note 2: All decimal values should be displayed to six (6) decimal places.
Name of particle species
Total number of occurrences of the species
Minimum momentum of the species
Maximum momentum of the species
Average momentum of the species
Two (2) data files are provided for use with the BASH script: small.dat and large.dat
Use the small.dat file to test and perfect the BASH script Use the large.dat file to produce the output you will include in the Linux Lab submission
Example (using the small.dat file) Contents (subset) of the small.dat file
NEUTRON 20.900103
PION- 0.215176
PION- 22.716532
NEUTRON 8.043279
PION+ 1.374297
PION- 0.313350
PION+ 0.167848
Summary of the complete small.dat file
Total Species: 26
Species Information:
Name Count Minimum Maximum Average
-------- ----- --------- --------- ---------
KAON- 1 5.489958 5.489958 5.489958
NEUTRON 2 8.043279 20.900103 14.471691
PHOTON 10 0.034664 1.897264 0.652727
PION- 5 0.192247 22.716532 5.145192
PION+ 7 0.167848 7.631051 2.691639
PROTON 1 1.160216 1.160216 1.160216
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered 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