Entrepreneur Geek

Nirav Mehta on life, technology and future

Archive for the ‘GNU/Linux’ Category

Finding number of lines in files recursively

without comments

I wanted to find the number of lines from a set of files – spread out in nested directories. The shell command “wc” is best for finding number of words / lines in files but it does not have an argument for recursive searching.

Here’s a quick shell command sequence that will find you the line count from all files in a directory – recursively.

find /topleveldirectory/ -type f -exec wc -l {} \; | awk '{total += $1} END{print total}'

Replace “/topleveldirectory/” with your directory of choice. Leave it as “.” to find from current directory and below.

Found on Unix.com

Written by Nirav

December 25th, 2009 at 10:07 am

Posted in Apple, GNU/Linux

Tagged with , ,

Introduction to Screencasting in Linux – recordMyDesktop

without comments

Screencasting is a great way to share information. I use it to show bugs to my team, to record training videos of the project management system I am working on, and even to record demos of project deliveries to clients. I use Jing to record videos from my Mac. But wanted to find something useful for Linux.

recordMyDesktop is a great Linux tool to record the entire desktop, a portion or an application. It outputs Ogg format video, which can easily be converted to AVI, QuickTime or FLV. It’s been there for a while, and is pretty solid.

What sold me though, was this video explaining how to use recordMyDesktop – and then to convert saved video into other formats. It’s easy to follow and covers all important aspects.

Introduction to Linux Screencasting - using recordMyDesktop

Introduction to Linux Screencasting - using recordMyDesktop

If you want to record screens from Linux, this is the best tool. Try it out!

(thanks Santosh for pointing me to this!)

Written by Nirav

November 24th, 2008 at 11:40 am

Posted in GNU/Linux

Tagged with ,

Congratulations Kartik!

with 4 comments

Congratulations Kartik for becoming a Debian Developer! You make me proud! It’s been a long journey. You have stayed on course despite all the odds. Congratulations!


Thanks for the graphic Kunal ;-)

Written by Nirav

August 6th, 2008 at 9:43 am

Posted in GNU/Linux, Updates

Tagged with ,

Grab more contacts – ContactGrabber does 10 sites now

with 10 comments

Attention: Contact Grabber is not actively maintained anymore. We recommend OpenInviter instead. OpenInviter supports more sites and is in active development.

The latest version of our GPL product ContactGrabber now allows you to fetch contacts from 10 different sites.

  • AOL (new)
  • LinkedIn (new)
  • Lycos (new)
  • IndiaTimes (new)
  • Yahoo
  • Orkut
  • Gmail
  • Rediff
  • Hotmail
  • Myspace

ContactGrabber allows you to retrieve the address book contact information from various sites. If you are developing a site and need your users to import their contacts from other sites, or recommend you to their contacts, this is a great solution!

ContactGrabber is developed in PHP and is released under GPL.

Note: As of now, Gmail has an issue with some email accounts. They are moving accounts from one server to another and that’s what is causing the problem. This should be corrected soon.

Download ContactGrabber from: https://sourceforge.net/projects/contactgrabber

The code has been contributed by Magnet’s Mumbai and Ahmedabad teams! Great work guys!

Written by Nirav

January 10th, 2008 at 2:22 pm

Search and Replace Recursively using sed and grep

with 10 comments

I have done this so many times, still I find a new problem doing recursive search and replace each time! Here's one small shell script that puts the issues I had on the Mac doing search and replace on a directory recursively.

Save the file as rpl.sh, chmod it 755, and execute it like:

CODE:
  1. ./rpl.sh folderContainingFiles/ oldText newText

Does the job for me! This could be done in a single line, I got some ideas of using xargs etc, but all that did not work on my Mac (at least). So resorting to this.

CODE:
  1. #!/bin/sh
  2. grep -rl $2 $1 |
  3.  while read filename
  4.  do
  5.  (
  6.   echo $filename
  7.   sed "s/$2/$3/g;" $filename> $filename.xx
  8.   mv $filename.xx $filename
  9.  )
  10.  done

And yes, if you are going to use this, take a little time and do some argument checking before passing them around! Unless you think only a God user like you is going to use it!

Written by Nirav

December 29th, 2007 at 1:21 pm

Posted in Apple, GNU/Linux