Create a data file called “students.txt” in the format given below, using VI: a.
ID: 3667932 • Letter: C
Question
Create a data file called “students.txt” in the format given below, using VI: a. student id character b. student name character c. cumulative gpa number d. classification character e. major character Each record element is spaced with a tab, with one student record per line, as follows:
256-56-8411 Bob 3.61 junior cs
471-44-7458 Tim 3.45 senior ce
326-56-4286 Rajesh 2.97 freshman te
548-66-1124 Eric 2.88 sophomore ee
447-21-3599 John 2.51 junior cs
911-41-1256 Rebecca 3.92 senior cs
854-22-6372 Robin 2.45 freshman te
2) Write Shell Command that sorts the file by student id (any order, display to screen).
3) Write Shell Command that sorts the file by name (any order, display to screen)
4)Write Shell Command that sorts the file on decreasing order of gpa (display to screen)
5)Write Shell Command that stores in ‘file1’ the names of all students whose major is cs
6)Write Shell Command that displays the number of students whose details are included in the file.
7) Write Shell Command that displays records of all students whose id does not start with 4
8) Using the answer to questions 6,7 write a script (called student_analysis) that - Takes a file similar to one created in 1, as an argument
Explanation / Answer
256-56-8411 Bob 3.61 junior cs
471-44-7458 Tim 3.45 senior ce
326-56-4286 Rajesh 2.97 freshman te
548-66-1124 Eric 2.88 sophomore ee
447-21-3599 John 2.51 junior cs
911-41-1256 Rebecca 3.92 senior cs
854-22-6372 Robin 2.45 freshman te
zz
cat output.txt
cat output.txt
4) sort -k 3 students.txt > output.txt
sort -r output.txt > decrop.txt
6) wc -l students.txt
8) create student_analysis.sh as follow
echo "Student analysis argument"
done
Now run chmod 777 student_anlysis.sh
pass file name as arguments to command like:
scripts$ student_analysis.sh student.txt
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.