Tuesday 21 February 2017

linux - First time using bash. Need to parse text file and assign to variables.

I have a csv file that looks like this.



TeamName,Metric,ON,OFF
name,469388,84,20
unassigned,1442,1,375
name2,61306,11,0
name3,245556,34,13
name4,918989,123,37
name5,143600,22,11
NONE,327208,36,11

name6,1010223,98,6
name7,130533,9,1
name8,8155,1,2
name10,327127,62,19
name11,327595,59,17


I would like to assign the first column (names) to a string named "team" and the second column (metric) to a string named "metric". The script should move line by align and re-assign the 'team' and 'metric' variables, overnighting the previous assignments.



The script should skip the first line.




I am researching how to do this now but any help would be appreciated.

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...