Danny Kon
asked on
I want to split a text file in how many names are in the text file (sorry for the bad explanation)
See attached file for the complete example
Datum Klant naam ArtCode
----- ---------- -------
1-4-2015 0:00:00 Cafe Brakke 20206
1-4-2015 0:00:00 Cafe Brakke 20110
1-4-2015 0:00:00 Cafe Lime 50110
1-4-2015 0:00:00 Cafe Lime 04355
1-4-2015 0:00:00 Café Pollux 16368
1-4-2015 0:00:00 Café Pollux 16356
In this example i need 3 x a text file, the first one called Cafe Brakke.txt and in the text file
Datum Klant naam ArtCode
----- ---------- -------
1-4-2015 0:00:00 Cafe Brakke 20206
1-4-2015 0:00:00 Cafe Brakke 20110
2nd file Cafe Lime.txt and in the file
Datum Klant naam ArtCode
----- ---------- -------
1-4-2015 0:00:00 Cafe Lime 50110
1-4-2015 0:00:00 Cafe Lime 04355
3th file Café Pollux.txt and in the file
Datum Klant naam ArtCode
----- ---------- -------
1-4-2015 0:00:00 Café Pollux 16368
1-4-2015 0:00:00 Café Pollux 16356
If somebody also can help me to remove the 0:00:00 behind the date it would be perfect (not necessary:)
Thanks for helping
Danny
Datum Klant naam ArtCode
----- ---------- -------
1-4-2015 0:00:00 Cafe Brakke 20206
1-4-2015 0:00:00 Cafe Brakke 20110
1-4-2015 0:00:00 Cafe Lime 50110
1-4-2015 0:00:00 Cafe Lime 04355
1-4-2015 0:00:00 Café Pollux 16368
1-4-2015 0:00:00 Café Pollux 16356
In this example i need 3 x a text file, the first one called Cafe Brakke.txt and in the text file
Datum Klant naam ArtCode
----- ---------- -------
1-4-2015 0:00:00 Cafe Brakke 20206
1-4-2015 0:00:00 Cafe Brakke 20110
2nd file Cafe Lime.txt and in the file
Datum Klant naam ArtCode
----- ---------- -------
1-4-2015 0:00:00 Cafe Lime 50110
1-4-2015 0:00:00 Cafe Lime 04355
3th file Café Pollux.txt and in the file
Datum Klant naam ArtCode
----- ---------- -------
1-4-2015 0:00:00 Café Pollux 16368
1-4-2015 0:00:00 Café Pollux 16356
If somebody also can help me to remove the 0:00:00 behind the date it would be perfect (not necessary:)
Thanks for helping
Danny
Oh you missed to attach the file. I just knew it
Need a sample of the input file, is it space delimited, or fixed column format (looks a bit like a report file), or are there tabs in it, etc?
~bp
~bp
ASKER
ASKER
Raheman
Almost there, 3 problems, 1 file is unreadable and does not have a name, a second file has the name ---------- .csv
and inside the file i see
þÿ"Datum","KlantNaam","Art code"
-----,"---------- ",""
All the files showing quotation marks around the names
þÿ"Datum","KlantNaam","Art code"
1-4-2015,"Black Tiger","01201"
And the text in the file always start with letters þÿ
Thanks Danny
Almost there, 3 problems, 1 file is unreadable and does not have a name, a second file has the name ---------- .csv
and inside the file i see
þÿ"Datum","KlantNaam","Art
-----,"---------- ",""
All the files showing quotation marks around the names
þÿ"Datum","KlantNaam","Art
1-4-2015,"Black Tiger","01201"
And the text in the file always start with letters þÿ
Thanks Danny
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Bill Prew,
It works like a charm but I can't get it to work in my powershell script "cscript.exe test.vbs"
But that has nothing to do with my question
Perfect solution
Thanks Danny
It works like a charm but I can't get it to work in my powershell script "cscript.exe test.vbs"
But that has nothing to do with my question
Perfect solution
Thanks Danny
save the example file in C:\Temp\DataFileSplit.txt (Modify it as required)
Output File Location : "c:\temp\" (Modify $OutputLocation as required)
Open in new window