i have a file like
col1, col2, col3, col4, col5, col6,col7,col8
a,b,c,d,e,1,t,11
b,e,,w,,1,,
c,r,c,d,e,1,t,11
d,f,c,g,w,1,e,22
e,f,c,d,e,1,w,33
f,e,f,r,t,1,t,22
g,h,t,d,e,2,s,22
h,t,,,e,2,f,
a,r,,,w,2,,
f,r,r,d,e,2,f,44
e,b,h,d,t,2,d,55
a,r,h,d,e,2,g,66
a,b,c,d,e,2,44
a,b,c,d,e,2,,
a,b,c,d,e,2,
a,b,c,d,e,2,55
I am concenered with specific cols -- (col6, col8) -- (1,11)
what i need to do is make out a new file out of this containing unique records of (col6,col8) excluding spaces in col8.
output of the above sample is:
1,11
1,22
1,33
2,44
2,55
2,66
this removes the duplicates, but how to ignore the blank of col8,
i tried this
nawk -F, '!a[$6,$8]++ {print $6 "," $8}' sample.dat
but it gives this output
col6,col8
,
1,11
1,
1,22
1,33
2,22
2,
2,44
2,55
2,66
what is that extra , after first line and how can i ignore blanks of col8.
pls help
