miércoles, 11 de noviembre de 2009

using Vim regexes everywhere

I'm at class atm, and 5 minutes ago I had to download some exams from past years.

There are quite a lot of them, and I just thought downloading them all by hand would be too much work for a Lazy man like me.

Then I used vim to help me :)

I just got the code where there were the links I wanted. It looked more or less like this:

<a href="2006t-c-40-lc.pdf">g40</a>,
<a href="2006t-c-40-lc-s-test.pdf"> solució del test</a>;
<a href="2006t-c-50-dc-test+problema.pdf">g50</a>,
<a href="2006t-c-50-dc-test_resuelto.pdf"> solució del test</a>,

Just open vim, paste the code and let the magic begin.

:%s:^:wget :
:w /tmp/downThemAll.sh

Now you just have to execute the script, and enjoy :)

Btw, yeah, I know about downThemAll, but I like using my own tools (and I dislike bloat).

No hay comentarios: