find is a great tool. But, find treats all files and all directories equally including .svn dirs. Suppose we need to see the directory structure of a certain directory and issue this command:
$ find . -type d
If the current directory is under svn version control, find will show many .svn directories, too. Well, since find is a great tool, it will have some filtering functions, too. 'man find' and we can come up with this to filter out .svn.
$ find . -name .svn -prune -o -print
Hmmm.. We select non-.svn by inverting the result. But, we don't know it is a file or directory. Unix has another great tool called egrep.
$ find . -type d | egrep -iv ".svn"
We used invert matching not in find, but in egrep. Inspecting a directory will be much easier with these two tools. For svn specific, we can use 'ls' command on svn.
$ svn ls -R
But, ls isn't good for distinguish file or diectory.
Thursday, May 29, 2008
Thursday, May 8, 2008
Python and DB2
We have a DB2 backend and I started to test it with PyDB2. Here is a tutorial link. In short, nothing is surprising. It uses standard python DBAPI interface with some good utility in DB2.db2util package.
Initially, I thought this client package would give different usage because DB2 client is different than postgres, mysql, or Oracle. However, PyDB2 is written well by supporting standard API.
Initially, I thought this client package would give different usage because DB2 client is different than postgres, mysql, or Oracle. However, PyDB2 is written well by supporting standard API.
Monday, May 5, 2008
Shell, Brace expansion
I found that I research this whenever I think of this function.
If I have to select file a,b,c only in /tmp, brace expansion is the answer. /tmp may have bunch of other files. Also repeating /tmp/a, /tmp/b, /tmp/c is annoying.
$ ls /tmp/{a,b,c}
Brace expansion is not used often, but when it is needed, it is super useful. I have to leave this note hoping that I have a place to lookup at least.
If I have to select file a,b,c only in /tmp, brace expansion is the answer. /tmp may have bunch of other files. Also repeating /tmp/a, /tmp/b, /tmp/c is annoying.
$ ls /tmp/{a,b,c}
Brace expansion is not used often, but when it is needed, it is super useful. I have to leave this note hoping that I have a place to lookup at least.
Subscribe to:
Posts (Atom)