Search My Blog

Monday, May 16, 2011

replace text in file linux

sed 's/old_text/new_text/' filename > outputfile

old_text - text to be replaced in file 'filename'
new_text - text to be substituted file 'filename'

the above command can be used to remove text from a file, by leaving the new_text blank :
sed 's/old_text//' filename > outputfile

Friday, May 13, 2011

Nutch, Solr, ......

I am working on developing a custom search using Apache Nutch in Java. Being bombarded with so much new stuff - nutch, lucene, servlet container, tomcat, jetty. Had never even heard these before !!!! Its a bit confusing, and a bit intimidating, but hope to make good sense of all these terms.

Tuesday, May 10, 2011

Charging a cell phone battery when charger/charging port does not work !

Do not want to buy a new charger if your charger does not work? Or has your cell phone had a gr8 fall, and the charging port is damaged?

DO NOT WORRY !!!

You can charge your cell phone battery using a USB cable. All you need to do is strip the cable on one side, and locate the red(+ve) and black(-ve) wires. Now, connect the red wire to the +ve terminal of your battery, and the black one to the -ve, while the battery is plugged into the phone.

Better yet, watch this video on Youtube : http://www.youtube.com/watch?v=9pYcgmLhUcQ

WARNING : I do not know if this damages your battery or not, but it is worth trying ;)

Persisting Environment variables in Linux

I was tired of changing the JAVA_HOME path everyday, before starting work at office. So I dug in a bit and found that you could make environment variables persistent by editing the file /etc/environment. If you locate the file and it opens in read-only mode, try 'sudo gedit /etc/environment' at the command prompt.