Some statistics on linux-greek-users mailing list and forum.hellug.gr

Out of boredom I decided to parse the Linux-Greek-Users (LGU) archives and create some graphs. Then I wrote a few more oneliners to deduct some numbers out of the archives. These numbers may or may not mean anything to someone, it’s entirely up to the reader.. Since the archives contain some amount of spam (not too much though) one must take that into consideration as well while reading the numbers I extracted below…

First thing I did was to download the index file containing the links to the monthly archives since February 1997:
wget http://lists.hellug.gr/pipermail/linux-greek-users/

Then download each month’s archive:
for i in `grep date index.html | cut -d"\"" -f2`; do foo=`echo $i|cut -d"/" -f1`; wget http://lists.hellug.gr/pipermail/linux-greek-users/$i -O $foo-date.html ; done
(more…)

delete all empty directories using xargs

I was trying to figure out one 1-liner to delete all empty directories in a tree.
The following should do it’s job:
%find -type d -empty | xargs rm -rvf

BUT! While this works for directories with “regular” filenames, it doesn’t work when there are special characters inside the filename. Consider this for example:

%ls -1
test 1
test2
test _ 3
%find -type d -empty
./test 1
./test2
./test _ 3
%find -type d -empty | xargs rm -rvf
removed directory: `./test2'
%find -type d -empty
./test 1
./test _ 3

Only directory “test2” was deleted. To delete the rest of the directories when they contain “special” characters like whitespace and quotes one needs to modify the command like this:

%find -type d -empty -print0 | xargs -0 rm -rvf
removed directory: `./test 1'
removed directory: `./test _ 3 '

🙂

commandlinefu.com random entry parser

I’ve written a small perl script to parse random entries from the extremely usefull commandlinefu.com website. Quoting from their site:

Command-Line-Fu is the place to record those command-line gems that you return to again and again.

The script code is very “clean”. I can almost say that it’s written in a very python-ish way.
Sample output:%./cfu.pl
CMD: for (( i = 0; i < 100; i++ )); do echo "$i"; done
URL=http://www.commandlinefu.com/commands/view/735/perform-a-c-style-loop-in-bash. Title=Perform a C-style loop in Bash.
Description: Print 0 through 99, each on a separate line.
%./cfu.pl
CMD: rsync -av -e ssh user@host:/path/to/file.txt .
URL=http://www.commandlinefu.com/commands/view/20/synchronise-a-file-from-a-remote-server Title=Synchronise a file from a remote server
Description: You will be prompted for a password unless you have your public keys set-up.

You can get it from here: commandlinefu.com random entry parser perl script

As far as I’ve tested, it works out of the box on default perl installations of Debian, Gentoo and Mac OS X.