Extract Values from CSV
Hi,
I need to extract values from a CSV file based on some conditions as explained below:
File format details:
1. each set starts with AAA only
2. number of columns is fixed
3. number of rows per set may vary (as they are having different CCC rows)
Now, i need to extract 3rd column of AAA and 4th columns of the lines starting with CCC of that set. These values of 1 dataset to form one line.
For. e.g, i have data for 3 sets and file has the below:
AAA,1,a,b,c,d
BBB,1,j,k,l,m
CCC,1,p,q,r,s
CCC,1,w,x,y,z
AAA,2,j,k,l,m
BBB,2,a,b,c,d
CCC,2,p,q,r,s
AAA,3,w,x,y,z
BBB,3,a,b,c,d
CCC,3,p,q,r,s
CCC,3,m,n,o,p
CCC,3,i,j,k,l
then the output must be (3 lines only as 3 data sets exist)
a,q,x
j,q
w,q,n,j
Please advise.
Thanks
Prvn