Write string to text file with length based on criteria

  • Hi All,
    I want to write a query string into a text file based on the length factor and comma.
    sample query:
    Insert in db.table 1 (col1_name, col2_name,col3_name,col4_name,col5_name) values ('col1values','col2value','col3value','col4value','col5value');


    lets say while writing the first line the 70th char is 5 in Col5_name, i dont want to cut the column name in the first line as col5 and write the second line as _name.
    I want to bring the column col5_name in the next line and stop the first line ending with comma. I am ok if my first line is less than 70 column.


    Please help. Thanks!!!