Extracting field values from .csv

How can I select the bold fields from the following?

"CLLI","SWREL","RPTDATE","RPTIME","TZ","RPTTYPE","RPTPD","IVALDATE","IVALSTART","IVALEND","NUMENTIDS"
"tklc9010801","EAGLE5 45.0.0-64.70.1","2013-08-07","02:01:50","MST ","COMPONENT MEASUREMENTS ON LINK","LAST","2013-08-07","01:30:00","02:00:00",2800

"STATUS","LSN","LOC","LINK","LNKTYPE","MSGSTRAN","MSGSRCVD","MSURETRN","OCTRETRN","MOCTTRAN","MOCTRCVD","MTCEUSG","DURLKOTG","MSGSRGTT","MOCTRGTT","TDCNGLV1","TDCNGLV2","TDCNGLV3","ECCNGLV1","ECCNGLV2","ECCNGLV3","MSGDISC0","MSGDISC1","MSGDISC2","MSGDISC3","LNKAVAIL","NMGWSDSABL","OUTCELLS","INCCELLS","SDPDUTRN","SDPDURCV","SDPDURTR","LMSUTRN","LMSURCV","LMSUOCTTRN","LMSUOCTRCV","LMSUTRNDSC","LMSURCVDSC","M2PUDMTR","M2PUDOCT","M2PUDMRC","M2PUDOCR","M2PLKNIS","ECLNKCB","ECLNKXCO"
"K","ls1101i00","1201","A  ","IPVL",0,0,0,0,0,0,0,1800,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
"K","ls1101n04","1201","B  ","IPVL",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1800,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

please generalize it as the values can be different as well

~thanks

@leghorn, You have not made it "2013-08-07","02:01:50" bold. What is the logic on which you need to extract the date and time fields?

Hi
yeah I did not,becoz they are not needed
please see that there are 11 fields in the first line .. "CLLI","SWREL" ...
corresponding to these there are values in the next line ..
so the value of IVALDATE is 2013-08-07 and so on ..
these fields are always on the 8th,9th and 10th tabs
I need the values of "IVALDATE","IVALSTART" and "IVALEND"

Two options, if the index is same (8th 9th and 10th) and the required values are in the 2nd line

awk -F, 'NR==2{gsub(/\"/,x);print $8,$9,$10}' file.csv

More generic one would be similar to the one posted on the other thread Perl to shell script - The UNIX and Linux Forums

awk -F, 'NR==1{gsub(/\"/,x);for(i=1;i<=NF;i++){a=$i;};getline;gsub(/\"/,x);for(i=1;i<=NF;i++){array[a]=$i}} END{print array["IVALDATE"],array["IVALSTART"],array["IVALEND"]}' file.csv

1st one looks good .. how do I save these values in the separate variables

thnx anyway,big help :slight_smile: