Wednesday, August 30, 2006

You probably know Google Video: this is an excellent animation film you can find on Google Video: Elephants Dreams

What is at stake with this small cartoon is that it was entirely created with free software: like Blender… Thus if you feel the heart of Tim Burton, enjoy Blender.

Regarding Elephants Dream, my opinion is that all the machine is in the head of the young person and that the old man is there to only try to maintain this beautiful machine. In fact he know that it can be realized only by maintaining the young person in the belief of the machine… If you have divergent opinions: leave a post; -)

If you want only to displays the first and third columns, it seems impossible... Actually, only for a windows user, because Linux or Unixhave a powerful tool to manipulate those file. One year ago, my girl friend had a huge huge file, a bit like that fora study about obesity, she tried to opened it with excel... But excel freezed becquse the file was too big... So she asked mefor a solution: I did all she wanted only by using command line tools and espescially awk! So now some example to measure thepower of awk. The awk command is as you have already probably understood a power pattern matching language that allows you to modify input lines by manipulating the fields they contain.

$ awk '{print}' file.txt

This has the same result as $ cat file.txt, it displays all the content of the file

$ awk '\toto\' file.txt

This has the same result as $ grep Heathrow file.txt, it displays only line which content the word Heathrow.

$ awk '\Lieberman\ {print $5,$7,$12}' file.txt

It only displays columns 5, 7 and 12 of line containing "Lieberman"

$ awk '{if ($3 <>

It displays columns 3 and 7 if the key 3 is less than 2000.

$ awk -F":" '{ print $3 "\t" $1 }' /etc/passwd |sort -g

Display user by increasing userid. Notice that if you want to print a tabulation you've to use \t, idem if you want print a new line, use \n.

$ awk -F"\t" '{ print $4 "\t" $10 }' file.txt

You can specified the separator with the command -F"\t" (notice that tabulation and space are the default one)

And this is only the beginning with some file, where you use a end line to separate data and a some sign like @ to separatea group of data,you can use awk to retrieve some informations:

Interesting isn'it?I hope it could help you, in fact this is not the best example, I know but if you were seqrching how to concatenate two files this is the tool you need, and I've just give you the syntax. I hope it will be helpful