Question: Can someone help me with my code? It has to work in Linux using this bash command awk - f employee.awk awkinput Below is the
Can someone help me with my code?
It has to work in Linux using this bash command
awk f employee.awk awkinput
Below is the code I have:
BEGIN
FS :
OFS
totalSalary
employeeCount
projectCount
$E
empid $
empnameempid $
emptitleempid $
empsalaryempid $
totalSalary $
employeeCount
$P
projid $
projnameprojid $
projmanagerprojid $
projectCount
$W
workid $
empid $
projid $
workingOnprojidempid
projEmployeeCountprojid
# NF
next
END
for projid in projname
print projnameprojid
print Name Title Salary
print
salaryIndex
for empid in workingOnprojid
empListsalaryIndex empsalaryempid: empid
n asortempList sortedEmpList, @valnumdesc"
projSalaryTotal
for i ; i n; i
splitsortedEmpListi empInfo, :
empid empInfo
salary empInfo
if empid projmanagerprojid
printf s s d
empnameempid emptitleempid salary
else
printf s s d
empnameempid emptitleempid salary
projSalaryTotal salary
projEmployeeCountprojidprojEmployeeCountprojid : projEmployeeCountprojid
projAvgSalary projSalaryTotal projEmployeeCountprojid
printf
print "employed on project: projEmployeeCountprojid average salary: projAvgSalary
employeeAvgSalary totalSalary employeeCount
print "Employees:", employeeCount, "Projects:", projectCount
print "Total Salary:", totalSalary
printf "Employee Average Salary: f
employeeAvgSalary
Below is the output for the code above, I can't get it exactly how it is and I can't upload it as a photo because chegg won't take it
Spice Mining
Name Title Salary
Paul Atreides Kwisatz Haderach
Leto Atreides Duke
Shaddam Corrino IV Padishah Emperor
Vladimir Harkonnen Baron
employed on project: average salary:
Bene Gesserit Schemes
Name Title Salary
Irulan Corrino Princess
Lady Jessica Reverend Mother
employed on project: average salary:
Muad'Dib's Jihad
Name
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
