I am trying to split the string in a file based on some delimiter.But I am not able to achieve it correctly... Here is my code below.
awk \'var=split($2,arr,
As some of the comments mentioned, you have nested single quotes. Switching one set to use double quotes should fix it.
awk 'var=split($2,arr,"\"); {print $var}' file1.dat
I'd prefer piping to another awk command to using split.I don't know that one is better than the other, it is just a preference.
awk '{print $2}' file1.dat | awk -F'\' '{...}'