I need to print the value which is double quoted and having delimiter as a value.
Sample data:
a,"b,c,d",e
a,b,c
a,,
c,,
command provided by @user4453924 How to make awk ignore the field delimiter inside double quotes?
awk '{while(match($0,/("[^"]+",|[^,]*,|([^,]+$))/,a)){
$0=substr($0,RSTART+RLENGTH);b[++x]=a[0]}
print b[2] ;x=0}' file
So when using the above command provided by @user4453924 , it's resulting only 2 rows as
"b,c,d",
b,
where as expected output is(4 rows, last 2 with null value) as:
"b,c,d",
b,
,
,
and Its working fine when last row is having some value at 2nd position but if last row is not having any value then its not considering that row or above one.
ANY HELP?