Page 1 of 1
DOS SORT EOF
Posted: 28 Oct 2009 02:48
by kale
I have a problem as I'm trying to sort a .dat file from position 1. Somehow the result will be a total mess: in the beginning there are a lot of blank lines and the the rest of lines are split into two separate lines (I have a path name in positions 30- and it will split all the path names to separate lines). If I before sorting go to the last visable line and do a delete then the file is OK and I can sort it normally without any problem. So there is an EOF which must be removed ?? How can I make it in the batch file ??
DOS SORT
Posted: 29 Oct 2009 11:36
by kale
I noticed that I don't have to do anything else but to open it in Notepad and save it (in ANSI, UTF-8 or UNICODE) and then it acts normally. Now I tried to do the change in the batch file so that I don't need to have any manual step but didn't succeed yet. Perhaps it's not a ANSI/UNICODE issue because it doesn't mattter in which of them you save it but it's enough that you open and save it ?? Have you any ideas what is the problem with the file and what's the way to do the manual saving in the batch file ??
Posted: 01 Nov 2009 08:39
by X-Zat
Hey, kale...
I do not exactly understand what you are trying to:
Do you want to sort an already existing .dat-file
or
Do you want to create a .dat-file to sort it later?
Normally, you can write into any file with:
(to add a line)
or
Code: Select all
echo blablabla[b]>[/b]blablabla.file
(to create a new one)
But I suppose that you already know that. Anyway, a batch can write into any file but reading?
As I know, a batchfile can read and write files that contains strings (like bat and Windows Script) only. A batch can't edit a file consisting of texts (like java and MP3).
I suppose, a .dat-file contains texts and not ordinary strings...
If I were you, I tryied another format like .ini or a new one like .kale (because the extension doesn't matter).
I hope I could help you, m8!
Bye, X-Zat.
DOS SORT
Posted: 01 Nov 2009 15:22
by kale
X-Zat wrote:Hey, kale...
I do not exactly understand what you are trying to:
Do you want to sort an already existing .dat-file
or
Do you want to create a .dat-file to sort it later?
Normally, you can write into any file with:
(to add a line)
or
Code: Select all
echo blablabla[b]>[/b]blablabla.file
(to create a new one)
But I suppose that you already know that. Anyway, a batch can write into any file but reading?
As I know, a batchfile can read and write files that contains strings (like bat and Windows Script) only. A batch can't edit a file consisting of texts (like java and MP3).
I suppose, a .dat-file contains texts and not ordinary strings...
If I were you, I tryied another format like .ini or a new one like .kale (because the extension doesn't matter).
I hope I could help you, m8!
Bye, X-Zat.
Thanks for the answer.
I really tried to sort an existing .dat file. I just found out that as I had created the input file there was one field that hadn't been initiated or nothing had been put in that field and that caused something special in that position which was something that it split the line at that position. But somehow this situation was fixed as soon as I saved the file (without any editing). I have now fixed the cause of the problem (put some data in this field) so I don't have to worry it anymore although I didn't understand. It would help if you could see the possible hidden characters in the file.
/ kale
Posted: 02 Nov 2009 13:33
by X-Zat
Hey, kale!
possibly hidden characters
Well... Do you mean characters that aren't shown in ordinary ANSI-Code?
If you do so, try to get a multi-editor like UltraEdit. Those editors should show you the missing oder hidden characters.
But think about:
What is a batch's sense during sorting a file that contains characters that aren't visible for itself? What can a batch file do in a file that contains unknown/hidden/missing characters? It can't get any input and it can't find any complete strings but strings that have the exception, not to contain those characters...
(Please excuse my bad English-skills
)
Bye, X-Zat
Posted: 02 Nov 2009 23:54
by kale
[quote="X-Zat"]
Thanks for the advice. I tried UltraEdit and saw that there were 0000 in those 2 bytes when it was acting falsely. Windows seems to be more sensible than Mainframe environment but of course this was an error that must be fixed anyway.
kale