Jump to content

krumvn

Members
  • Gesamte Inhalte

    4
  • Registriert seit

  • Letzter Besuch

Alle erstellten Inhalte von krumvn

  1. Mein Ziel ist zwei Textdateien zeilenweise* zu vergleichen und die unterschiedliche Zeilen mit Erläuterung in dritte datei zu speichern. *z.B. text1 text2 a b b d c a d z e f text 3 e von text1 nich gefunden in text2 f von text1 nich gefunden in text2 c von text1 nich gefunden in text2 z von text2 nich gefunden in text1 Ich hoffe so ist mein ziel klar. LG Krum
  2. Hallo nochmal :), also danke für die Rückmeldung. Ich habe mich entschlossen die Zeichenkombination zu ersetzen. Also falls der ERRORLEVEl von findstr nicht gleich 0 ist, baue ich ein "Filter", falls ERRORLEVEL wg. Sonderzeichen != 0, ersetze ich "/_" mit "/" set string1=%string1_1:\_=\% REM wenn string1 != string1_1 heisst es: Änderung ist vorgenommen, REM geänderte string wird in einer tmp-datei gespeichert if %string5% NEQ %string1_1% (echo %string1_1%>>tmp.txt) else (echo Findstr hat es richtig gemacht) REM da bei mir zwei tmp-dateien sind und jetzt mit sauberen Inhalt REM (o. Sonderzeichen) kann ich die nochmal mit findstr durchsuchen REM und richtig auswerten) Das alles funktioniert momentan, aber im Dauer soll ich was shlaueres rausfinden. Also Danke nochmal! MfG Krum
  3. Hi Zahni, da liegt aber mein Problem nicht, sondern, dass findstr %ERRORLEVEL% ungleich 0 liefert, trotz Trefer und zwar genau wenn die Zeichenkmbination "\_" in \Documents and Settings\user\Desktop\testverzeichnis\test\blabla\_shell.pyd exsistiert. z.B set "string1=\Documents and Settings\user\Desktop\testverzeichnis\test\blabla\_shell.pyd" set "string2=\Documents and Settings\user\Desktop\testverzeichnis\test\4_8.dll" REM in datei.txt gibt es 2 Zeilen: REM \Documents and Settings\user\Desktop\testverzeichnis\test\blabla\_shell.pyd REM \Documents and Settings\user\Desktop\testverzeichnis\test\4_8.dll set datei=datei.txt findstr /c:"%string1%" "%datei%" echo %ERRORLEVEL% findstr /c:"%string2%" "%datei%" echo %ERRORLEVEL% Output ist: C:\Documents and Settings\user\Desktop\testverzeichnis>findstr /c:"\Document s and Settings\user\Desktop\testverzeichnis\test\blabla\_shell.pyd" "datei.txt" C:\Documents and Settings\user\Desktop\testverzeichnis>echo 1 1 C:\Documents and Settings\user\Desktop\testverzeichnis>findstr /c:"\Document s and Settings\user\Desktop\testverzeichnis\test\4_8.dll" "datei.txt" \Documents and Settings\user\Desktop\testverzeichnis\test\4_8.dll C:\Documents and Settings\malikrrw\Desktop\testverzeichnis>echo 0 Was kann ich machen damit findstr alles richtig macht???:confused: Auf jeden Vorschlag würde ich mich freuen. MfG krum
  4. Hallo zusammen, ich erstelle gerade eine batch-Datei, die die Aufgabe hat, zwei Verzeichnissstrukturen zu vergleichen. Ich suche die beiden Verzeichnisse rekursiv durch, dann werden die Namen der Dateien+Verzeichnisse in 1.txt und 2.txt gespeichert. Z.B 1.txt \Documents and Settings\user\Desktop\testverzeichnis\test\1.exe \Documents and Settings\user\Desktop\testverzeichnis\test\3_3_.dbd \Documents and Settings\user\Desktop\testverzeichnis\test\4_8.dll \Documents and Settings\user\Desktop\testverzeichnis\test\Kopie von 3_3_.dbd \Documents and Settings\user\Desktop\testverzeichnis\test\Kopie von 4_8.dll \Documents and Settings\user\Desktop\testverzeichnis\test\blabla\_shell.pyd und 2.txt (identisch) \Documents and Settings\user\Desktop\testverzeichnis\test\1.exe \\Documents and Settings\user\Desktop\testverzeichnis\test\3_3_.dbd \Documents and Settings\user\Desktop\testverzeichnis\test\4_8.dll \Documents and Settings\user\Desktop\testverzeichnis\test\Kopie von 3_3_.dbd \Documents and Settings\user\Desktop\testverzeichnis\test\Kopie von 4_8.dll \Documents and Settings\user\Desktop\testverzeichnis\test\blabla\_shell.pyd und jetzt das Problem: wenn ich die Dateien 1.txt und 2.txt zeilenweise vergleiche: ..... :COMPARE set "Arg1=struct.SOLL.txt" set "Arg2=struct.IST.txt" set "COMPARE=1vs2.txt" for /f "usebackq delims==" %%f in (%Arg1%) do call:Processline "%%f" goto:EOF :Processline set "var1=%~1" if -compare EQU %var1% (goto:COMPARE) if struct.IST EQU %var1% (goto:EOF) findstr /b /e /c:"%var1%" "%Arg2%">nul if %ERRORLEVEL% EQU 0 (echo +from %Arg1% ... %var1% found in %Arg2% >>%COMPARE%) else (echo %ERR_LEV% %ERRORLEVEL% ! %Arg1% --- %Arg2% %var1% from %Arg1% not found in %Arg2% >> %COMPARE%) goto:EOF dann bekommen ich in 1vs2.txt folgendes: from struct.SOLL ... \Documents and Settings\user\Desktop\testverzeichnis\test\1.exe found in struct.IST from struct.SOLL ... \Documents and Settings tings\user\Desktop\testverzeichnis\test\3_3_.dbd found in struct.IST from struct.SOLL ... \Documents and Settings\user\Desktop\testverzeichnis\test\4_8.dll found in struct.IST from struct.SOLL ... \Documents and Settings\user\Desktop\testverzeichnis\test\Kopie von 3_3_.dbd found in struct.IST from struct.SOLL ... \Documents and Settings\user\Desktop\testverzeichnis\test\Kopie von 4_8.dll found in struct.IST 1 ! struct.SOLL --- struct.IST \Documents and Settings\user\Desktop\testverzeichnis\test\blabla\_shell.pyd from struct.SOLL not found in struct.IST from struct.IST ... \Documents and Settings\user\Desktop\testverzeichnis\test\1.exe found in struct.SOLL from struct.IST ... \Documents and Settings\user\Desktop\testverzeichnis\test\3_3_.dbd found in struct.SOLL from struct.IST ... \Documents and Settings\user\Desktop\testverzeichnis\test\4_8.dll found in struct.SOLL from struct.IST ... \Documents and Settings\user\Desktop\testverzeichnis\test\Kopie von 3_3_.dbd found in struct.SOLL from struct.IST ... \Documents and Settings\user\Desktop\testverzeichnis\test\Kopie von 4_8.dll found in struct.SOLL 1 ! struct.IST --- struct.SOLL \Documents and Settings\user\Desktop\testverzeichnis\test\blabla\_shell.pyd from struct.IST not found in struct.SOLL d.h dass die letzte Zeile in beiden Dateien nicht richtig verglichen werden kann (wahrscheinlich wg. "\_") Wie kann ich die Sonderzeichen umgehen und endlich die Zeilen auf Gleichheit prüfen? :confused: MfG Krum
×
×
  • Neu erstellen...