Remove New line Char from Text file
Moderator: DosItHelp
Re: Remove New line Char from Text file
any other script by which i can remove it, or i can split it in 2-3 parts
Re: Remove New line Char from Text file
You can probably use GAWK but this option uses an MSDOS program called change
from here: http://www.erols.com/waynesof/CHAN0208.ZIP
It doesn't handle long filenames or pathnames so the extra copy command is needed.
from here: http://www.erols.com/waynesof/CHAN0208.ZIP
It doesn't handle long filenames or pathnames so the extra copy command is needed.
Code: Select all
@echo off
:: uses change http://www.erols.com/waynesof/CHAN0208.ZIP
:: no long filename support
copy /b "Z:\STG_URS\1\115A_CONTRACT_EXPER" "Z:\STG_URS\1\temp.tmp"
(
echo -f^&h0a
echo -tNULL
echo -f^&h0d
echo -t^&h0d^&h0a
)>change.ctr
change Z:\STG_URS\1\temp.tmp /nZ:\STG_URS\1\newfile /binary /overwrite /cchange.ctr
del change.ctr
del "Z:\STG_URS\1\temp.tmp"
Re: Remove New line Char from Text file
@aaksar:
I must confess I am confused about this situation. At this topic you requested help to solve a problem (the same problem than this topic). I indicated you that we need additional details in order to distinguish CR+LF characters embedded in the record, and that your description was too vague. There are several details that may help us to write a suitable solution: What is the exact format of the file? What is the maximum record lenght? etc. The usual way to solve these problems is via succesive modifications guided by OP's feedback. However, you gave us no additional details, just abandoned that topic and created a duplicated one with the same question!
I take a second look at your problem trying to grasp the details you had not provided, and modified my Batch solution accordingly; however, I have no way to check if my solution is correct. I downloaded your XY_110A_CONTRACT file and run my solution on it: the original file have 467 lines and the modified one 361; my program reported 21 broken records fixed. This is a partial listing of some of the brokens records:
Antonio
I must confess I am confused about this situation. At this topic you requested help to solve a problem (the same problem than this topic). I indicated you that we need additional details in order to distinguish CR+LF characters embedded in the record, and that your description was too vague. There are several details that may help us to write a suitable solution: What is the exact format of the file? What is the maximum record lenght? etc. The usual way to solve these problems is via succesive modifications guided by OP's feedback. However, you gave us no additional details, just abandoned that topic and created a duplicated one with the same question!
I take a second look at your problem trying to grasp the details you had not provided, and modified my Batch solution accordingly; however, I have no way to check if my solution is correct. I downloaded your XY_110A_CONTRACT file and run my solution on it: the original file have 467 lines and the modified one 361; my program reported 21 broken records fixed. This is a partial listing of some of the brokens records:
Broken records:
===========================================
"0711105","11","00000","119",2010-05-03-22.13.00.000000,"119",2012-12-12-12.13.00.000000,"M15",08/01/2008,"13",07/15/2007,07/15/2008,"E",," ",,"Prop XOL 10M x5M + 5M Swiss 41",,0,"N",0,"N","N",,"900","B5","30","46","44","4","N","P","P","D","119","119",07/15/2007,07/14/2008," ","00000","N","119"," ",,,," "," "," "," "," "," ",,0.00,0.00,0.00," "," "," ",0.00,"D"," "," ","N",,"","Wind excluded only to all 1st and 2nd tier counties from TX to SC inclusive.
Reinstatement equals 1 x 150% "," "," "," "
===========================================
"0811102","11","00000","119",2010-05-04-15.48.00.000000,"119",2013-01-15-13.25.00.000000,"M15",08/01/2009,"13",07/15/2008,07/15/2009,"E",," ",,"Prop XOL 2.5M x 2.5M + 15M 137",,0,"N",0,"N","N",,"900","B5","30","46","41","4","N","P","P","D","119","119",07/15/2008,07/14/2009," ","00000","N","119"," ",,,," "," "," "," "," "," ",,0.00,0.00,0.00," "," "," ",0.00,"D"," "," ","N",,"","Hurricane excludes US TX through ME Tier 1 and 2 counties.
Additional premium of $600,000 in four equal installments due 7/15/2008, 10/15/2008, 1/15/2008 and 4/15/2009 "," "," "," "
===========================================
"0910102","10","00000","119",2010-07-12-14.57.00.000000,"119",2011-01-19-11.50.00.000000,"M15",03/01/2007,"15",04/01/2009,03/31/2010,"E",," ",,"SIRL XS Caslty XOL 2009 - 223 ",,0,"N",0,"N","N",,"130","B1","30","42","41","4","N","P","P","M","119","119",04/01/2009,03/31/2010," ","00000","N","119"," ",,,," "," "," "," "," "," ",,0.00,0.00,0.00," "," "," ",0.00,"D"," "," ","N",,"","5 deposits are due on this contract.
Due dates are:
05/01/2009 = $142,187.50
06/01/2009 = $1,279,687.50
09/01/2009 = $1,421,875.00
12/01/2009 = $1,421,875.00
03/01/2010 = $1,421,875.00
Reinstatement Provisions
1 @ 40%
1 @ 45%
"," "," "," "
===========================================
Antonio
Re: Remove New line Char from Text file
It's not the same issue Antonio - in this problem the character to be removed are solitary line feed characters.
This is done above by removing ALL line feeds and then replacing ALL CR with a CR/LF pair.
This is done above by removing ALL line feeds and then replacing ALL CR with a CR/LF pair.