Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Textdatei auslesen, String bei Trennzeichen trennen und in neue Datei schreiben

Empfohlene Antworten

Veröffentlicht

Hallo zusammen!

Ich stehe grade vor einem kleinen Problem, dass mir den letzten Rest Nerven raubt...

Ich bekomme von einem unserer Kunden täglich eine Textdatei, in dieser stehen in einer Zeile alle Informationen die wir brauchen und diese sind mit Trennzeichen (') von einander getrennt. Aktuell trenne ich die Datei noch händisch, weil die Batch noch nicht so fluppt, wie ich mir das vorstelle.

ein Beispiel für die Datei (verkürzt):

+ABCD'CDAB'AB DE'ABBE AA'

Es sind also noch weitere Sonderzeichen und vor allem Leerzeichen in der Textdatei.

Mit diesem Skript funktioniert es noch nicht so ganz supi:

@echo off 

for /f "delims=' tokens=1,*" %%i in (string1.txt) do set "Line=%%j" & call:sub %%i !line:'= ! & goto :eof


:sub 

@echo %1 >> String2.txt

If [%2]==[] goto :eof

Shift & goto :sub 

Dies liefert mit aber folgende Ausgabe:

+ABCD

CDAB'AB

DE'ABBE

AA'

Es wird also nicht sauber getrennt... Kann ich das überhaupt mit einer Batch korrekt abwickeln? Bin für jede Hilfe dankbar! (ich hoffe ich hab auch verständlich genug erklärt, wo mein Problem liegt ;)

Danke

Raggi

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.