Friday, May 25, 2007

Less is more

Very often when working on a project I deal with extremely large application log files which
poor old notepad.exe, or even trusty Ultraedit
just can't deal with.

Enter the windows port of the unix tool less,
which easily opens even the largest logfiles. The problem is
that running it in a command window makes copying text difficult, selecting a page at
a time and pasting it all back together into a file.

Which brings me to my useful tip. To copy any length of text from less to a file try the following.

navigate to the beginning (or end) of the piece of text you wish to copy, type
(for mark) and enter a marker letter of your choice at the prompt

navigate to the other end of the piece of text you wish to copy and press
(thats the pipe character, is the shifted value of the key '\' )
enter your marker letter at the prompt.
At the exclamation prompt enter

less -oC:\file.txt

where c:\file.txt is the name of the file you wish to write the data to.

This will open a new less session on your new file , you can hit Q to escape this
if you so wish.

Voila, text copied from less under windows.

p.s another quick tip , to make less behave like tail, simply press F while viewing the file.

Thursday, May 24, 2007

Froogle Friends

First post I'm going to go (relatively) old school with a simple
windows batch file. This tip is actually the one that inspired
me to create this blog I had actually forgotten about it
(my friends don't seem to have much interest in froogle!) but
I rediscovered it today and decided to share it here so others
can benefit (or at least I'm unlikely to forget it again!)

Everybody knows Froogle right?

good. Ok having had a browse and put some items I'm interested
in on my wishlist, I was curious to see if anyone else I knew
had done the same thing and Google being the forward thinking
people they are had provided the facility where you can put in
a friends email and see their wishlist (or a message saying they
don't have one)

Well being blessed with a large number of friends (or at least
other peoples email addresses) that looked like a lot of typing
and clicking that I would have to repeat to see if people had
updated or, indeed, created wishlists.

So I set about creating a batch file that would do the job for
me and here it is.


FOR /F %%A IN (email.txt) DO (c:\progra~1\Mozill~1\firefox.exe^&email=%%A^&Find=Find)

(all the above is on one line!)


  1. email.txt (in same directory as batch file) contains a list of email addresses on separate lines.
  2. I have firefox in there but you can use xp ( firefox will by default open these all in tabs, internet explorer of course will open separate windows, and interestingly will wait for you to close one before opening the next).
  3. this works on XP , changes may be required for older/newer versions of windows.
feel free to suggest a better way of doing this, I suspect yahoo pipes would be feasible and much cooler solution.