Question
I can't attach the csv so I don't understand the comment I pasted the contents of the csv into the question though below. And some
I can't attach the csv so I don't understand the comment I pasted the contents of the csv into the question though below. And some screenshots of what it looks like when opened with excel and wordpad
Unix Awk scripting
Help appreciated.
In this lab, youll use 2 folders: An Inbound from where youll be writing your script, and an Auto folder where all files that are ready for automatic processing will be placed.
The input file is called sample_enrollment.csv
Name the pre-processed file enrollment_.csv
Consider the file sample_enrollment.csv. It is an Enrollment File that must be pre-processed before it can be run automatically. You are to write an AWK script, lab4_1.awk, to do the pre-processing according to the requirements below:
First, change "EffectiveDate" header to "Effective Date".
Then for each of the requirements below, write a function to complete it:
The Effective date for Drop status must be changed to the last day of the month of the associated Effective Date. For example, in the sample file, the last record has a Drop status. Its effective date is 03/25/2018. This must be changed to 03/31/2018.
Format the area code and Home phone number fields to 3 digits and 7 digits respectively. For example, in the sample file, the first record has no value for the area code and "+1 206 8497834" for the home phone. This should be changed to Area code = 206, and Home phone = 8497834.
Remove all records with Change status so that only the Add and Drop statuses will be processed.
Finally, save the changed contents in a new filename (as indicated above) and place a copy into the Auto folder.
sample_enrollment.csv
"EffectiveDate","Status","EmployeeID","ClientID","MemberFirstName","MemberMiddleName","MemberLastName","MemberSSN","DOB_Month","DOB_Day","DOB_Year","Address1","Address2","City","State","ZipCode","AreaCode","HomePhone","Email","Deduction Method","Customer_Defined","Relationship","Primary","FamilyID","UniqueID" "05/12/2017","Add","534336699","1511","Jon","B","Doe","123456789","3","17","1980","67 NW 67th Street","","Tempe","AZ","85281","","+1 206 8497834","ift383@asu.edu","Employer payroll deduction","","P","Y","9170885","109170885" "11/25/2017","Drop","534336699","1511","Alpha","","Gaspart","987654321","4","21","1961","7659 E 12th Ave","","Seattle","WA","98117","","+ 206. 369.2073","ift383@asu.edu","Employer payroll deduction","","S","N","9170885","200319606" "12/11/2017","Change","534336699","1511","Mat","J","Simmon","987123456","10","7","1995","1234 W 17th Street","","Seattle","WA","98106","","+ 206.369.2073","ift383@asu.edu","Employer payroll deduction","","C","N","9170885","200319607" "03/25/2018","Drop","534336699","1511","Lance","","Peck","123087654","12","2","2010","12 S Pokoma, #15","Bldg 1002","Boulder","CO","76540","","+ 9172701515","ift383@asu.edu","Employer payroll deduction","","C","N","9170885","200319608"
EffectiveDate | Status | EmployeeID | ClientID | MemberFirstName | MemberMiddleName | MemberLastName | MemberSSN | DOB_Month | DOB_Day | DOB_Year | Address1 | Address2 | City | State | ZipCode | AreaCode | HomePhone | Deduction Method | Customer_Defined | Relationship | Primary | FamilyID | UniqueID | |
5/12/2017 | Add | 534336699 | 1511 | Jon | B | Doe | 123456789 | 3 | 17 | 1980 | 67 NW 67th Street | Tempe | AZ | 85281 | +1 206 8497834 | ift383@asu.edu | Employer payroll deduction | P | Y | 9170885 | 109170885 | |||
11/25/2017 | Drop | 534336699 | 1511 | Alpha | Gaspart | 987654321 | 4 | 21 | 1961 | 7659 E 12th Ave | Seattle | WA | 98117 | + 206. 369.2073 | ift383@asu.edu | Employer payroll deduction | S | N | 9170885 | 200319606 | ||||
12/11/2017 | Change | 534336699 | 1511 | Mat | J | Simmon | 987123456 | 10 | 7 | 1995 | 1234 W 17th Street | Seattle | WA | 98106 | + 206.369.2073 | ift383@asu.edu | Employer payroll deduction | C | N | 9170885 | 200319607 | |||
3/25/2018 | Drop | 534336699 | 1511 | Lance | Peck | 123087654 | 12 | 2 | 2010 | 12 S Pokoma, #15 | Bldg 1002 | Boulder | CO | 76540 | 9172701515 | ift383@asu.edu | Employer payroll deduction | C | N | 9170885 | 200319608 |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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