2 Feb 2005 00:17
Re: Validating Text Strings & Isolating files with odd characters
On Tue, 01 Feb 2005 21:41:02 -0000, awnster wrote:
> Sorry for the confusions. Here are some clarifications to my previous
> message:
>
> 1) Check the text files if it contain the letter "A" qualifier (3rd
> character from the left in the example) in the HDR record. example:
> HDR*A*ADDRESS*APPLICATION123456789).
>
> Q: R is the third character from the left, above. * is the fouth from
> the left.
> A: The letter "A" qualifier is the 5th character from the left.
>
> 2) Check for odd characters, for this example we can use the tilde
> character "~".
>
> Q: What do you mean by odd? 1,3,5,7,9?
> A: Odd character such as "ñ" and square shape characters (are
> these
> control charaters?). I am using the "~" instead of the square
> character since I cannot copy & paste the square character to the
> message.
>
> 3) Move files that does not have the "A" qualifier or contain the
> tilde character "~" to c:\error\errorlog.txt.
>
> Q: Do these text files contain any characters that are not
> alphanumeric?
> A: Yes, it can have *, #, -, &, $, etc.
I used Sam's code - it's untested.
<at> echo off
for /f "delims=" %%a in ('dir c:\stage\*.txt /b') do call :EVAL "%%a"
GOTO :EOF
:EVAL
findstr /r "^HDR\*A" "c:\stage\%~1" > nul
if %errorlevel%==0 GOTO :EOF
findstr "~" "c:\stage\%~1" > nul
if %errorlevel%==1 GOTO :EOF
move "c:\stage\%~1" c:\error
>>c:\error\errorlog.txt echo Moved file %1
--
--
Regards,
Mic
To Post a message, send it to: batchworld@...
To Unsubscribe, send a blank message to:
batchworld-unsubscribe@...
RSS Feed