Hi,
I have a issue, I need to loop through a comma delimited file and check for the length which exceeds specified length , if Yes truncate the string.
But my problem is , I do not have to check for all the fields and the field lenght is not same for all the fields.
For ex:
Say my line
ahjdh,dfhkajhdf,adhklf,eiour
say I need to check length only for 2nd and 4th and max length for 2nd is 6 and max length for 4th field is 4.
Can somebody please help me.
I was trying with AWK , but couldn't move forward with it , please let me know if my logic is correct.
awk 'BEGIN{ FS = OFS = ","
l="13,2000,160,200,100,50,50,30,30,30,170"
split(l,len,",")
row=$1
split(f,field,",")
f="1,3,11"
split(c,col,",")
}
{
for (i=1;i<=len,i++) {
for (j in len) {
if
if (length($(field)) = len[j] )