[KLUG Programming] sorting, uniq'ing, and grepping
Robert G. Brown
programming@kalamazoolinux.org
Mon, 14 Jul 2003 10:54:02 -0400
On Mon, 14 Jul 2003 10:11:21 -0400, Tony Gettig <tony@gettig.net> wrote:
>I've got a process that I am trying to convert to a C program....
>I've got the file combining working....
I'd have to see your code. The wonderful thing about pseudocode is that
you get a picture of what you have to do, and implementing it in something
"real" is even better, since it shows itself correct, at least informally,
over time.
The problem with the pseudocode you've got is that it does not suggest good
implementation methods.. you've noted the steps in some high level (command
level) way, but you have not shown how the work actually gets done.
For example, the business of combining files and finding the unique rows,
and sorting, can all be done in essentailly one algorithm. MAybe you have
done a great job of coding it this way, but I can't tell that from your
pseudocode, or your narrative.
>It compiles on all the platforms listed above using different compilers....
Probably because you're being a good citizen and writing in ANSI C or
something close to it. A good practice, IMO.
>Am I nuts? Should I just stick to the shell?
Nah, this is a good idea, and quite feasible. If you are slavishly following
your own psuedocode, you're probably writing too much code, but you'll reach
your goal in due course.
The more you run this, and the more places you want to run this, the better
a C implementation of what you want will look.
>myprogram combines the files then...
>shell out to sort, uniq, & grep to files...
>myprogram picks up from there
It's really amazing how little code this saves, assuming it's written right.
>Can you tell I'm not a full time programmer? :)
>From the moment I met you, Tony! :)
Regards,
---> RGB <---