mssever said: Then I'd probably look for the first occurrence of each line ending and get the offset of it. Then by looking at the smallest offset, I'd have my answer. I have no idea how to accomplish something like this in Bash, because I'd never attempt such a project in Bash. Other languages make this kind of thing so much easier. You'll likely have to resort to some other language (such as awk, Perl, Ruby, etc.) to get that info.
Good idea, thankyou. I can probably find a way to do that using perl…
It's quite likely that your project would be simpler if done in another language, especially if it's a big project (Bash doesn't scale well). Of course, that's not always true, as there are some tasks for which Bash is ideal. But based on what you've said so far, I think you'd benefit from considering a switch. And Python might not be as hard to learn as you might think. Why not give it a weekend and see how quickly you progress?Well, it started out as a small script and now i have 156 kb of sources…:lolflag:
Originally I didn't thought that it would that complex, anyway now, after a couple of months, is almost finished (all the features originally planned implemented at least in an acceptable form - even this autodetect is not really needed, since it is highly improbable to get a windows-formatted file outside windows, but i'd like to include it for flexibility…) and i'm not so eager of rewriting everything…:biggrin: Afaik, Bash is good in managing text streams, although is not the only one, for now it is working well even with that behemoth 24,7MB file i got. An usual imput file will be around 1.6MB, anyway.:)
If a hack job is acceptible, you could have a multi-lingual project, where you write a script in, say, Python that does some stuff and spits its output in a way that your Bash script can handle. That would minimize the amount of rewriting you have to do.That is perfectly acceptable. Perl would be my first choice in doing something like that, since, as you pointed out before, i'm already depending on it.
Coding a GUI in Bash sounds to me like a nightmare, unless your needs were so simple that zenity could handle it without resorting to all sorts of contortions.Sorry, my fault.
I never intended to code the gui in bash, absolutely, that would be insane!:lol:
The "engine" will be cross-platform, but every platform will have is own gui… I'm not even sure that i'm going to do the gui myself: i'd prefer to stay away from windows if possible, i have bad dreams when working on that os…:rolleyes: