Wednesday, September 1, 2010

Pipes for Windows?

Today I had to get a list of files out of a zip file and append them into an Excel formatted spreadsheet. As a long time Unix user and being someone unfamiliar with Windows, the easiest way I could think of in under a minute is to use zipinfo and sed and sort to build a CSV file and then paste it into the Excel spreadsheet. It's pretty simple, just:
zipinfo -1 foo.zip | sed -e 's/.*\///' | sort -n -t_ -k2 > foo.csv
(The parameters to sort say to sort by the second field, delimited by '_' characters, which I need to do for this problem).

All very easy on -- from the Unix/Linux shell. The system that will ultimately use these files runs Windows. Is there any quick and dirty way to do this kind of throw-away scripting on Windows?

I have used Cygwin before, and could install it, but it always takes several hours to install, which seems like an awful lot of work to avoid a few file transfers. Of course, I could do the entire process manually under Windows, copying and pasting filenames from Windows Explorer. However, I have about 15 of these files which would make it pretty time consuming.

At the other extreme, I could probably write a .NET program in a few hours, but I have few enough files that copying and pasting from the CSV file is faster just typing a simple command line (though with .NET stuffing data directly into the spreadsheet becomes pretty easy).

So how would you handle this on Windows? Is there something similar to Unix pipes that lets you quickly handle one-off tasks like this?

No comments:

Post a Comment