#!/usr/bin/csh #CS 345 #File Name: Project 3 #group members #1. Guillermo Cervantes #2. Edwin Panameno #3. Jimmy Hoo #(1) Download the "Daily Major" from the http://ir.calstatela.edu/ir web site. # - Remove the unwanted top and bottom portion of the Excel file, keep the # field's name, and then save it as a comma-delimited file. # - Replace all blank spaces in the field's name with an underscore (_). Do # this for the field's name ONLY. #(2) List ALL Academic Levels (ACAD LEVEL) together with the total students # of these levels. # EX.: # B0: firt time freshman # B1: 3230 freshman # B2: sphemore # B3: junior # B4: Senior 4512 # G1: 1st time grad # G2: # G3: # PB: second bahelors set academicLevels=`awk -F, '{print $7}' Daily_Major.csv | sort | uniq` # Iterate thru each academic level #Comments: OK! printf "______________________________________________________________________________\n" printf "2. List ALL Academic Levels (ACAD LEVEL) together with the total students\n" printf "\nACAD STUDENTS\n" foreach al ($academicLevels) set count=`grep -cw $al Daily_Major.csv` set count=`awk -F, '{if($7 ~/'$al'/) print $7, $al'} Daily_Major.csv | wc -l` printf "%4s %8d\n" $al $count end printf "______________________________________________________________________________\n" unset academicLevels unset count unset total #(3) Find out how many department are there in the College of ET? If a department # is UNKNOWN (or blank), then list it as "N/A". #Comments: You did not list the number of students in each of these departments. #(-6) printf "3. Find out how many department are there in the College of ET\n\n" awk -F, '$1 ~/ET/ {if($2 ~/ /) $2 = "N/A"; print $2}' Daily_Major.csv | uniq printf "______________________________________________________________________________\n" #(4) Which of these departments has the most number of students? #Comments: Good! set majors=`awk -F, '$1 ~/ET/ {if($2 ~/ /) $2 = "N/A"; print $2}' Daily_Major.csv | uniq` printf "Which of these departments has the most number of students\n" awk -F, '$1 ~/ET/ {if($2 ~/ /) $2 = "N/A"; print $1,$2}' Daily_Major.csv | sort >! majors_file.csv awk -F, '$1 ~/ET/ {if($2 ~/ /) $2 = "N/A"; print $2}' Daily_Major.csv | sort >! ET.csv set tot_stu_cnt = 0 set enrollmentMax = 0 set majorIndex = 0 # TODO: this needs to be changed to 0 to take into affect the printf "\nMajor Students Total\n" foreach m ($majors) set sc=`grep -c $m ET.csv` if($sc > $enrollmentMax) then @ enrollmentMax = $sc @ majorIndex += 1 endif @ tot_stu_cnt += $sc printf "%-6s%8d%6d\n" $m $sc $tot_stu_cnt end echo echo "Highest enrollment in ET: $majors[$majorIndex]" printf "______________________________________________________________________________\n" unset majors unset enrollmentMax unset majorIndex #(5) Give a breakdown of all stduents based on their ACAD LEVEl in the CS # department. # What is the total of students enrolled in CS this quarter? # What is the percentage of the total number of students in CS versus the # total number of students in the College of E&T? #Commments: Good! printf "5. Total of students enrolled in E&T College, CS count, CS students percent in E&T\n\n" awk 'BEGIN{csCounter=0;percent=0.0}{if($1 ~/CS/){csCounter++;}}\ END{percent = (csCounter / NR);printf ("%40s %10d %s", "Total Students in E&T College:",NR,"\n");\ printf ("%40s %10d %s","Total Students in CS Major:",csCounter,"\n");\ printf ("%40s %10f %s","Percentage CS Students in E&T College:",percent,"\n")}' ET.csv rm ET.csv