Hi All,
I have a CSV
file which is as below. Basically I need to take the year column in it and find if the year is >= 20152 . If that is then I should subtract all values by 6. In the below example in description I am having number mentioned as YYWW
so I need to subtract those by -5. Whereever I find the year I have ti subtract by -5. If the year is >201601 then I have to subtrct by -6. The year representation is 52 week. so if the week falls on 03 for example 201403 then the subtraction of -6 will yield 201347. I am planning to do in C++
,not sure if this possible with awk
or sed
.
Year representation goes like
201101
201103
..
..
..
201151
201152
201201
201202
Original
id,description,type,year,obj
994475,1832 +TRANS 1835 10/17/18,S,201835,P
994477,1836 + NOTAPP 1839 10/17/18,S,201839,1
828058,CONTROL 1452-1527,1552-1627,S,201627,OP
828059,1452-1527,1552-1627,S,201627,UU
Modified
id,description,type,year
994475,1820 +TRANS 1829 10/17/18,S,201829,P --------------------- Year is 2018 should be subtracted by 6
994477,1830 + NOTAPP 1833 10/17/18,S,201833 ,1 --------------------- Year is 2018 should be subtracted by 6
828058,CONTROL 1436-1521,1546-1621,S,201621,OP --------------------- Year is 2016 should be subtracted by 6
828059,1447-1522,1547-1602 ,S,201622,UU --------------------- Year is 2015 should be subtracted by 5