5

Check for length which exceeds specified length in a line

view full story
linux-howto

http://www.unix.com – 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. Code: awk 'BEGIN{ FS = (HowTos)