Showing posts from January, 2011

Mini HOWTO: Getting file names in Zip-archives using Bash

I'm gathering stats about my archives, and one of these is getting all the file names in them. There are some challenges about it, so let me show the required commands.

Getting file names from the one archive:

unzip -l /path/to/zip-file | tail -n +4 | head -n -2 | cut -c31-

Executing pipelined commands in xargs:

xargs -I {} -i sh -c 'command1 | command2 | ... | commandN'

For my case I've used the expression:

find . -iname "*.zip" -print0 | xargs -0 -n1 -I {} -i sh -c 'unzip -l {} | tail -n +4 | head -n -2 | cut -c31-' | sort | uniq -c
Yeah, yeah, black magic, gotcha Good luck!

CouchDB introduction

A phenomenon of document-oriented databases is quite interesting - many software developers face problems there this kind of databases is an excellent choice, but these developers don't use them and reinvent the wheel using relational or object-oriented databases. Difficult to say why it happens - because of ignorance, fear of performance problems or desire to reinvent own wheel, but this situation widely spread over the world. Fortunately, the common sense is prevailing, and NoSQL movement prove it.

I have a serious experience with IBM Lotus Notes/Domino, and one of the most interesting features for me on first stages of its studying was saving application design in the documents. Thus the deployment of Lotus Notes database is incredibly easy - one just have to copy NSF-file to another location and it's ready for use (not always, but for trivial cases it's enough). Sometimes it can be a really useful feature, especially during prototyping, but not so many document-oriente…