Question: An example input file is scores.csv. Write a AWK script to transform the input file in the following ways: 1) in the header line, prob_desc
An example input file is scores.csv.
Write a AWK script to transform the input file in the following ways:
1) in the header line, "prob_desc" should be changed to "comments". In the non-header lines
2) "Participant " should be added in front of "Identifier" value
3) prob_id values in the second field should be renamed from 1-5 to 3_a, 3_b, , 3_e
4) if the input score value is 1, the transformed output value should be 0, and otherwise if the input score value is 0, the transformed output values should be 10, 5, 5, 5, 5, respectively for problem ids 1 through 5.
Your solution should not depend on the ordering of rows in the input file, except the header row will always come first.
********************* scores.csv *************************
Identifier,prob_id,score,prob_desc 748737,1,0,code compiles 748737,2,0,input 101 748737,3,0,input 10011 748737,4,0,empty input 748737,5,0,bad input 748708,1,0,code compiles 748708,2,0,input 101 748708,3,1,input 10011 748708,4,0,empty input 748708,5,1,bad input 748701,1,0,code compiles 748701,2,0,input 101 748701,3,0,input 10011 748701,4,0,empty input 748701,5,1,bad input ***********************************************************
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
