tomasz86

How to merge two text files?

238 posts in this topic

I guess I'll have to stick to Update Inis as reordering the sections in this case doesn't have any influence on how update.inf works... and what's more important is that Update Inis seems to work smoothly.

You can still parse just the sections, before the "update" and then re-order the updated ini along those.

The original idea of splitting everything was exactly to have a way to keep the same section order.

jaclaz

0

Share this post


Link to post
Share on other sites

jaclaz,

There is a problem with your script when system unicode code page is set to different languages, ex. if I set it to Korean and run your script I get this:


?kbid -> ?##쬴bid
&Send -> ?#쬢end
US & Canada -> US ?#?Canada
< -> ?###?
etc.

Edited by tomasz86
0

Share this post


Link to post
Share on other sites

jaclaz,

There is a problem with your script when system unicode code page is set to different languages, ex. if I set it to Korean and run your script I get this:

Well, you obviously need to review the half-@§§ed replacement strings I made for gsar to take care of this cases.

I have no idea what is "different" with those, but surely a "text" comparison doesn't help, do a hex one instead.

jaclaz

0

Share this post


Link to post
Share on other sites

It'd have to be done for each language separately then :huh:

Isn't it possible to set a "fixed" codepage?

0

Share this post


Link to post
Share on other sites

It'd have to be done for each language separately then :huh:

Isn't it possible to set a "fixed" codepage?

I haven't yet understood (I fear because you completely failed to provide meaningful data to allow me to do so :ph34r:) what exactly the issue is.

I need:

  • the file BEFORE the runnning of the scripts
  • an EXACT description of the scripts you ran on it - or better a copy of the actual scripts you ran - and the order in which you ran them
  • the file AFTER the running of the scripts

Standard litany :whistle: :

http://homepages.tesco.net/J.deBoynePollard/FGA/problem-report-standard-litany.html

jaclaz

0

Share this post


Link to post
Share on other sites

Well, after doing more tests I can say that it's not your script which is messing things up but yanklines.vbs script which I use to remove duplicates from files in SPLIT_* folder. When I have encoding for non-Unicode programs set to English or Polish, there are no problems but when I change to Korean it gets messed up.

Shall I still upload the files?

0

Share this post


Link to post
Share on other sites

Shall I still upload the files?

Well, not for me, unless it is a VERY OBVIOUS problem in the .vbs, it is UNlikely I can help you with it :ph34r: .

But I am pretty sure that someone will try and help you with it, so why don't you provide the files anyway

jaclaz

0

Share this post


Link to post
Share on other sites

I've just switched back to Polish when using yanklines but I'll try to post these files later on.

However, I found two problems in splitinf.cmd

These type of lines


[Product.RunOnce]
;IE Installer
HKLM,"Software\Microsoft\Windows\CurrentVersion\RunOnceEx\101","002",,"%11%\mlang.dll|DllRegisterServer"
HKLM,"Software\Microsoft\Windows\CurrentVersion\RunOnceEx\101","004",,"%11%\browseui.dll|DllRegisterServer"
HKLM,"Software\Microsoft\Windows\CurrentVersion\RunOnceEx\101","005",,"%11%\browseui.dll|DllInstall|I"
HKLM,"Software\Microsoft\Windows\CurrentVersion\RunOnceEx\101","034",,"%11%\mshta.exe /register"

become


[Product.RunOnce]
;IE Installer
HKLM,"Software\Microsoft\Windows\CurrentVersion\RunOnceEx\101","034",,"%11%\mshta.exe /register"

after processing the file by splitinf.cmd. It's probably the "|" character to make them "disappear".

The other problem is that


[Strings]
START_PAGE = "http://www.microsoft.com/isapi/redir.dll?prd=ie&pver=6&ar=msnhome"

becomes


[Strings]
START_PAGE = "http://www.microsoft.com/isapi/redir.dll?prd = ie&pver = 6&ar = msnhome"

0

Share this post


Link to post
Share on other sites

I have one question. I use the following script to update *.cab files (fp40ext.cab in the example) from Win2k SP4


MD TEMP\fp40extcab
EXPAND -F:* %SP6%\fp40ext.cab TEMP\fp40extcab >NUL
FOR /F %%I IN ('DIR/B TEMP\fp40extcab') DO (
IF EXIST HFMER\%%I (
ECHO Processing %%I
XCOPY/DY HFMER\%%I TEMP\fp40extcab\ >NUL
)
)

I use XCOPY/DY to copy only files that are newer than the ones in the destination folder. I would be interested in having the "Processing %%I" displayed only when the actual file is copied and replaces the other one. Now it's displayed for all files regardless of whether they are actually copied or not (when they're older). Could it be done in a simple way?

0

Share this post


Link to post
Share on other sites

just a thought but why not get rid of the ECHO Processing %%I and remove the >NUL from the line below it!

Then again you may be able to remove the FOR loop entirely and simply run XCOPY with an additional /U switch!

0

Share this post


Link to post
Share on other sites

I use XCOPY/DY to copy only files that are newer than the ones in the destination folder. I would be interested in having the "Processing %%I" displayed only when the actual file is copied and replaces the other one. Now it's displayed for all files regardless of whether they are actually copied or not (when they're older). Could it be done in a simple way?

What about:

MD TEMP\fp40extcab

EXPAND -F:* %SP6%\fp40ext.cab TEMP\fp40extcab >NUL

FOR /F %%I IN ('DIR/B TEMP\fp40extcab') DO (

IF EXIST HFMER\%%I (

XCOPY/DL HFMER\%%I TEMP\fp40extcab\

XCOPY/DY HFMER\%%I TEMP\fp40extcab\ >NUL

)

)

Depending on the output you have in your language, you may want to use something like:

XCOPY/DL Source\%%I Target\ | FIND /V "0 File" | FIND /V "1 File"

(if a file is NOT copied, XCOPY will display (on my Italain System "0 File" and when a file is actually copied "1 File")

jaclaz

0

Share this post


Link to post
Share on other sites

I like the XCOPY/U (XCOPY/DUY in this case) method for its simplicity ;)

I tested the other one suggested by jaclaz too (XCOPY/DL) but it asks whether to overwrite file or not. Also I'd prefer to have the script language neutral (I myself sometimes switch between different system locales).

There is just one more thing related to this part of the script:


MD TEMP\fp40extcab
EXPAND -F:* %SP6%\fp40ext.cab TEMP\fp40extcab >NUL
XCOPY/DUY HFMER\*.* TEMP\fp40extcab\

I need to repack the archive but It'd be nice to have it done only when there are new files copied. Before I used something like this:


FOR /F %%I IN ('DIR/B TEMP\fp40extcab') DO (
IF EXIST HFMER\%%I (
ECHO Processing %%I
XCOPY/DY HFMER\%%I TEMP\fp40extcab\ >NUL
IF NOT EXIST TEMP\fp40extcab\new MD TEMP\fp40extcab\new
)
)
IF EXIST TEMP\fp40extcab\new (
ECHO.&ECHO Repacking fp40ext.cab...
CABARC N %SP6%\fp40ext.cab TEMP\fp40extcab\*.* >NUL
) ELSE (
ECHO There are no new files to add.
)

Quite primitive but did the job more or less :ph34r: Now it's not applicable when the whole loop is replaced by XCOPY with the /U switch. Does anyone have any idea how such a checking could be done? Of course I can just always repack the archive even if there are no new files but it increases the time unnecessarily (especially when cabs such as driver.cab are processed...).

0

Share this post


Link to post
Share on other sites

I tested the other one suggested by jaclaz too (XCOPY/DL) but it asks whether to overwrite file or not.

Owww, comeon :whistle: , use XCOPY/DLY

jaclaz

0

Share this post


Link to post
Share on other sites

Owww, comeon :whistle: , use XCOPY/DLY

Of course but then the only difference between the two is:

XCOPY/DY


1 Files(s) copied

vs.

XCOPY/DLY


1 File(s)

Edited by tomasz86
0

Share this post


Link to post
Share on other sites

Owww, comeon :whistle: , use XCOPY/DLY

Of course but then the only difference between the two is:

XCOPY/DY


1 Files(s) copied

vs.

XCOPY/DLY


1 File(s)

NO, the difference is that the L switch WON'T actually copy the file AND it will show the name of the file IF it corresponds to the D switch.

jaclaz

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.