|*Some text (Bold) is veriable, and will be change every day.|
ah, i did not understand that file A changes. file B only needs line four changed, correct? not anything else in the file, just line 4. File A, only extract from line 2, right?
2.My ID is "STAR_10112009_113500(STAR_some date_ some time)"
here, you had parentheses in the string at file A line 2. Are they not there? or just sometimes there? or always there?
since your latest update doesn't have them, i will take it they're not there for now.
I'll give it one more go based on this:
set /a Atarg=2
set /a Btarg=4
:put space at end of mid1 and mid2, after "is"
set mid1=My friends name is
set mid2= and id is
set /a N=0
for /f "tokens=1 delims=" %%a in (B.txt) do (
set /a N+=1
if !N! equ !Btarg! (
) else (
echo %%a >> C.txt)
move /y C.txt B.txt
set /a M=0
:make sure 1 space after 'delims=' just before the quote
for /f "tokens=1-3,4* delims= " %%b in (A.txt) do (
set /a M+=1
if !M! equ !Atarg! (
set x2=!mid1! !x1!" !mid2! !x!"
echo !x2! >> C.txt
if "!bite!" equ "!text!" goto ex
:END OF CODE is at :ex
the above script worked on my system using the data you gave me so there's not much more that i can do for you. If it fails this time, you'll probably have to start a new thread to try to get more capable programmers (i am not very good, the other people are much better at this.) good luck.