views:

171

answers:

9

I need to create a simple program/utility to parse a txt file (deleting blank rows, concatenating lines, etc) that runs in Windows XP and can be called from a Windows command line. What programming language/environment best fits this type of application?

Thanks, I hope I'm not being vague.

+4  A: 

I would recommend Python.

Tomas Lycken
+1 Purely because Python plays much nicer on Windows than Perl does. Native support for Windows path separators is a plus. Also, great built-in libraries for manipulation paths via `os.path`. Text manipulation may be easier (for some) in perl than python, but python gets my vote on windows every day purely because it plays nicer and doesn't force unix semantics into a non-unix environment.
Nathan Ernst
+1  A: 

Perl? Python? C#?

Really, any will do.

Yann Ramin
+1  A: 

perl or python may work well for you.

If it's a very simple problem, you may wish to take a look at sed or awk.

WhirlWind
+6  A: 

perl was designed from the ground-up for text processing

James L
I went with Perl and it works beautifully, thanks :) Although one day I would like to learn Python
Axsuul
+2  A: 

Perl is my first and last one too.... i think it was made from scratch for something like this.

Vinothbabu
+1  A: 

First I'd use a scripting language, because those are usually easier/faster to get used with. And they are flexible and you don't need to compile things after each change, you can modify the code directly and just run it.

Secondly I wouldn't use a general purpose language, like C# or Python. While they will do great, they are really not the right tool for the job. They have lots of APIs and lots of choices to choose from. They are also tied to a runtime/fx, that needs to be deployed to the target machine.

Consider a "parsing" kind of language like Perl. Or you may want to use something like PowerShell. But I think Perl will do just great.

Ion Todirel
A: 

As others have mentioned, Perl or Python are good options, but if you don't want to install anything else, you can use JavaSript with Windows Scripting Host, which is far easier than C/C++ or Bash Scripting (other options that don't require additional software).

JoeCoder
+2  A: 

For a zero-install option, albeit a bit fiddley, you could use good ole Batch Files. Here is an awesome resource for this

JBRWilkinson
A: 

I'd say Gawk though I don't know if anyone uses it under Windows. (G)awks basic syntax is even easier to learn than Perl (you can learn most of it in a day), especially if you know any C-like programming language.

Helper Method