Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Computing > Alt Msdos Batch > FOR \F loop tru...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 2719 of 2775
Post > Topic >>

FOR \F loop truncating record content???

by Learner <dearbrij@[EMAIL PROTECTED] > Jun 11, 2008 at 08:58 AM

I am using the following DOS command script to append date (which is
part of the file name) to every record in the file.

It works fine just that I am having a problem as described below.

@[EMAIL PROTECTED]
 off
setlocal enabledelayedexpansion
del "xyz.txt" 2>nul
for %%i in (abc*.txt) do set yfn=%%~ni&set yfn=!yfn:~-6!&for /f
"usebackq delims=" %%j in ("%%i") do echo "!yfn!"^|%%j>>"xyz.txt"

FYI - The FOR loop above is a long single line ending with .....
>>"xyz.txt"

The problem I am having is more like data related. It is truncating
the records for some special characters. One such char I know of is
"!" exclamation sign. If it is part of any record in the file the
record truncates here upto a certain point when it finds another
special char - Here is an example record.

Input record - for an input file name abc_080606.txt

8271909100343836|9999999999999|****TAL,ROBERTO|4424 FERRARI DR|DUPATE
ADDRESS!|SEBRING|FL|33872-2883|4424 FERRARI DR| |SEBRING|FL|33872-2883|
06|$= $~ .D ;O ?? AA BO CF CQ D0 D1 D2 D3 JW K: K> M# V. XP ZH }{ }}|
33872288300042008|20051102|20080606|00010101|20080606|A0I||A0I|AT|  |
|  |DV

and the output record looks like this - with the date added in front
of the record
If you notice it truncates at ! and then starts again after the ':'
sign.

"080606"|8271909100343836|9999999999999|****TAL,ROBERTO|4424 FERRARI DR|
DUPATE ADDRESS K> M# V. XP ZH }{ }}|33872288300042008|20051102|
20080606|00010101|20080606|A0I||A0I|AT|  |  |  |DV

Any help - why the records are losing part of their content will be
really appreciated?
 




 5 Posts in Topic:
FOR \F loop truncating record content???
Learner <dearbrij@[EMA  2008-06-11 08:58:51 
Re: FOR \F loop truncating record content???
foxidrive <gotcha@[EMA  2008-06-12 02:22:21 
Re: FOR \F loop truncating record content???
Learner <dearbrij@[EMA  2008-06-11 11:31:10 
Re: FOR \F loop truncating record content???
Timo Salmi <ts@[EMAIL   2008-06-12 02:11:00 
Re: FOR \F loop truncating record content???
"billious" <  2008-06-12 08:34:31 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Aug 27 19:11:16 CDT 2008.