CSV parsing methods in Linux

  1. #To get emails from CSV which is exported form your mail box
  2.  
  3. grep -o -i '[^,]*@[^,]*' contacts.csv
  4.  
  5. #Cut the required column assuming delimiter to be ","
  6.  
  7. cut -d, -f2,3 < input.csv
  8.  
  9. #For given index range
  10.  
  11. grep ${VALUE} input.csv | cut -d, -f${INDEX}
  12.  
  13. #Get first two columns of the cvs file
  14.  
  15. awk '{print $1"\t"$2}' input.csv
  16.  
  17. #CSV which is of the regex /^(.*),,/ $f is the file here
  18. awk -F,'{ if ($1 != "") prefix=$1; else printf "%s%s\n", prefix,$0 }' $f
  19.  
  20. # CSV of the format field1 , field2 , field3 , field4
  21. # we can set the FS to a regexp as FS=’^ *| *, *|
  22.  
  23. # FS=',
04 Oct

sudo add-apt-repository | Karmic kool

in

The Changelog of Karmic read so :


software-properties (0.75) karmic; urgency=low

* new helper script "add-apt-repository" that can be used to
enable a repository from the commandline. Useful for e.g.
'add-apt-repository ppa:gnome-desktop'
* fix error in auto-upgrade settings when
dpkg-reconfigure unattended-upgrades was used (LP: #387704)
* po/zh_TW.po:
- updated, thanks to Roy Chan (LP: #365040)
* softwareproperties/kde/SoftwarePropertiesKDE.py:
- do not error on cancel (LP: #364288)

01 Oct

Howto Set up your own Google wave sever on Ubuntu?

PyGoWave Server | Google wave server needs the following :

Python 2.6.1
Django 1.0.2
Orbited 0.7.7
RabbitMQ 1.6.0
Python libraries

lxml 2.2
PIL 1.1.6
carrot 0.5.0
Optional:

django-rosetta 0.4.0

JavaScript libraries:
MooTools 1.2
MochaUI 0.9.5

Get the dependencies :

sudo apt-get install python-mysqldb

sudo easy_install carrot

easy_install --find-links http://www.pythonware.com/products/pil/ Imaging

sudo apt-get install mercurial

Get Python : sudo apt-get install python

Get Django :

01 Oct

install-gnome-shell-ubuntu-kamric-jaunty

1) Get curl

sudo apt-get install curl

2) Build deps :

sudo apt-get install libgnomeui-dev librsvg2-dev libreadline5-dev libwnck-dev python2.5-dev libgstreamer-plugins-base0.10-dev libgl1-mesa-dev libffi-dev xulrunner-1.9-dev mesa-common-dev gtk-doc-tools subversion git-core bison flex

3) Exec the script

bash gnome-shell-build-setup.sh

4) Build the source

~/bin/jhbuild build

Replacing :

1) Go to the folder of the GNOME Shell:

cd ~/gnome-shell/source/gnome-shell/src

2) execute the command sequence to start the GNOME Shell:

./gnome-shell

01 Oct

OOIdenti.ca | Update identi.ca status from OO

After OOTwitter i tired a similar one for indeti.ca, the steps are as before you download the file from the attachment.

30 Sep

OOoTwitter | Open office Twitter

Question : How to twitt from open office?

Download and open this :OOTwitter

Now goto :
Tools -> Macros -> Organize macros -> OpenOffice. Org Basic.
Edit the OOoTwitter "username:yourpassword" to yours
Restart OO and then Tools-> Add-ons -> Post to Twitter
Now Twitt from OO :O)

Understanding the code :


'************************************************************
' POST TO TWITTER
'************************************************************

20 Sep

How to use the real-time Earth wallpaper script for Linux

How to use the real-time Earth wallpaper script for Linux

1.Save code part to a file, say change.sh

while [ 1 ]; do
COUNTER=0
while [ $COUNTER -lt 60 ]; do
wget http://www.opentopia.com/images/cams/world_sunlight_map_rectangular.jpg -O world.jpg
temp=$(stat -c%s world.jpg)
if [[ $temp > 1000 ]]
then rm world_sunlight_Wallpaper.jpg
mv world.jpg world_sunlight_Wallpaper.jpg
break
fi
sleep 5
let COUNTER=COUNTER+1
done
sleep 3600
done

2. Create a new folder in your home partition, say wall.
3. Set permissions and run :

$ cd ~/wall

11 Sep

AMD/ATI | Black Edtion 64bit on ubuntu | Fixing Issues

P.S : The below discussion is considering AMD/ATI into frame.

AMD Phenom has many variates the latest belonging to family(16) model(4) stepping(2) with flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc pni monitor cx16 lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skin.

29 Aug

Resolving application dependencies | apt-cache

Normally while updating an application in GNU/Linux, we download the source and compile and install it. Sometimes we find it hard to install when there are many dependencies.

Consider an example of installing Pidgin and IM, the latest version is 2.6.1, if we start compiling from source we come across few dependencies.

In normal procedure we would have to find the dependencies manually and install them with APT or aptitude.

22 Aug

Pidgin 2.6.1 adds XMPP Voice and Video support (but not on Windows)

Long awaited in the list, voice support for pidgin for GNU/Linux is out, most of them were on Skype all these days for Voice and Video, not any more i feel, with this advancement it's nice to hear and talk also.

Howto install from source:

For Ubuntu user, you may just setup from PPA :

To setup the PPA, copy-and-paste these commands into a terminal:

sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com \ 67265eb522bdd6b1c69e66ed7fb8bee0a1f196a8
echo deb http://ppa.launchpad.net/pidgin-developers/ppa/ubuntu \ `lsb_release --short --codename` main | \