Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
jerryh91
- Posts: 2
- Joined: 27 Jun 2012 10:52
#1
Post
by jerryh91 » 27 Jun 2012 14:44
I'm trying to do a line by line comparison of 2 .txt files. But the problem is for the first file I'd like to start comparing line by line after the first 9 characters of each line of the first 10 lines in the 1st file with the second file. I read somewhere that you can extract substring, but I've only seen format where you have to specify the length of the substring (~start,length), for mine each line has a different length. How do I accomplish this?
Code: Select all
< !logPath! (
FOR /F "tokens=*" %%A in (%refLogPath%) DO (
set logLine=
set /p logLine=
set refLogLine=%%A
echo !logLine!
echo !refLogLine!
REM check logLine against refLogLine(ENG-REF.log)
REM skip 1st 9 chars of each line
if NOT !logLine!==!refLogLine! (
set flag=false
echo !logLine!
) else (
set flag=true
echo !flag!
)
-
foxidrive
- Expert
- Posts: 6031
- Joined: 10 Feb 2012 02:20
#2
Post
by foxidrive » 27 Jun 2012 19:30
Do you only want 10 lines compared? What kind of info do you need regarding any differences?