Improper wrapping of text in split of file

Hi
I am using shell script where I am calling SQLPLUS and executing one PL/SQL block.

This PL/SQL block generates the spool file for example splfile.txt.
After successful generation of spool file I use nawk to split this file into 2 different files. Till here no issues.

[I use following syntax to split file]

 
nawk -F"|" -v var1="${v_project}" -v var2="${v_net}" -v var3="${v_path}" '{
fn=var3 "/ABS_" (length($1)==2?"AAAA":"BBBB") "_" var1 "_" var2 ".txt"
print > fn
}' ${v_path}/spoolfile.txt

In one of the split file where the fields are seperated by pipe '|' delimiter having issue with wrapping the text into next line and
eating up the spaces which results in incorrect output format

Actual required format is:-
AA|999999999|111|222|11-22|2|AAAAAAAAAAAAAAA |4444 g. ttttttt |ffffff 229292-s-2-222 |888888|yyyy hhhh | | |yyyy/mm/dd| | | |3|7777777777|asjhasjdhjdjasjhg|666|333| | |
AA|999999999|111|222|11-22|2|AAAAAAAAAAAAAAA |4444 g. ttttttt |ffffff 229292-s-2-222 |888888|yyyy hhhh | | |yyyy/mm/dd| | | |3|7777777777|asjhasjdhjdjasjhg|666|333| | |

Example of output in SQL plus in windows environment (i.e the file generated in windows environment)
AA|999999999|111|222|11-22|2|AAAAAAAAAAAAAAA |4444 g. ttttttt |ffffff 229292-s-2-222 |888888|yyyy hhhh | | |yyyy/mm/dd| | | |3|7777777777|asjhasjdhjdjasjhg|666|333| | |

In Unix Environment
AA|999999999|111|222|11-22|2|AAAAAAAAAAAAAAA |4444 g. ttttttt |ffffff 229292-s-2-222 |888888|yyyy hhhh | | |yyyy/mm/dd| | ||3|7777777777|asjhasjdhjdjasjhg|666|333| | |

I am putting both one after another for easy comparison
AA|999999999|111|222|11-22|2|AAAAAAAAAAAAAAA |4444 g. ttttttt |ffffff 229292-s-2-222 |888888|yyyy hhhh | | |yyyy/mm/dd| | | |3|7777777777|asjhasjdhjdjasjhg|666|333| | |
AA|999999999|111|222|11-22|2|AAAAAAAAAAAAAAA |4444 g. ttttttt |ffffff 229292-s-2-222 |888888|yyyy hhhh | | |yyyy/mm/dd| | ||3|7777777777|asjhasjdhjdjasjhg|666|333| | |

Actually from 8th filed the line is wrapping into next line (so I see some spaces are eaten up) again in 17th column space is eaten up
I doub't the carriage return is eating up the spaces or I am doing something wrong or there is some other way to this ?? I am clueless here ...
(Before I spool the file, I am setting the required LINESIZE in SQLPLUS i.e. SET LINESIZE xxx)

I should say thanks to those who read my above problem patiently......

Please let me know if I am not clear on any of the above lines ....so that I can tell in more detail to make it clear

Regards
JC

---------- Post updated at 12:51 PM ---------- Previous update was at 12:44 PM ----------

I think code is not wrapped correctly ...

Actual required format is:-

AA|999999999|111|222|11-22|2|AAAAAAAAAAAAAAA                                   |4444 g. ttttttt                                   |ffffff 229292-s-2-222                             |888888|yyyy hhhh           |          |  |yyyy/mm/dd| | | |3|7777777777|asjhasjdhjdjasjhg|666|333|  | |
AA|999999999|111|222|11-22|2|AAAAAAAAAAAAAAA                                   |4444 g. ttttttt                                   |ffffff 229292-s-2-222                             |888888|yyyy hhhh           |          |  |yyyy/mm/dd| | | |3|7777777777|asjhasjdhjdjasjhg|666|333|  | |

Example of output in SQL plus in windows environment (i.e the file generated in windows environment)

AA|999999999|111|222|11-22|2|AAAAAAAAAAAAAAA                                   |4444 g. ttttttt                                   |ffffff 229292-s-2-222                             |888888|yyyy hhhh           |          |  |yyyy/mm/dd| | | |3|7777777777|asjhasjdhjdjasjhg|666|333|  | |

In Unix Environment

AA|999999999|111|222|11-22|2|AAAAAAAAAAAAAAA                                   |4444 g. ttttttt          |ffffff 229292-s-2-222                             |888888|yyyy hhhh           |          |  |yyyy/mm/dd| | ||3|7777777777|asjhasjdhjdjasjhg|666|333|  | |

I am putting both one after another for easy comparison

AA|999999999|111|222|11-22|2|AAAAAAAAAAAAAAA                                   |4444 g. ttttttt                                   |ffffff 229292-s-2-222                             |888888|yyyy hhhh           |          |  |yyyy/mm/dd| | | |3|7777777777|asjhasjdhjdjasjhg|666|333|  | |
AA|999999999|111|222|11-22|2|AAAAAAAAAAAAAAA                                   |4444 g. ttttttt          |ffffff 229292-s-2-222                             |888888|yyyy hhhh           |          |  |yyyy/mm/dd| | ||3|7777777777|asjhasjdhjdjasjhg|666|333|  | |

FYI there is not only LINESIZE that can be set setup (in sqlplus), you could for example also have a look at some of the following "trim" and other "wrap" stuff below and play with different values of these options and change or adapt it to fit your needs

set array 100
set pages 0
set wrap off
set flush off
set feed off
set feedback off
set echo off
set verify off
set term off
set head off
set trim on
set colsep "|"
set linesize 800

do you need those blank stuff ?
Why don't you just remove all space and tabs in all of them (or at least those that are accolate to a | delimiter)