Execute mysql command from shell

2010-02-04 1 min read Database

phpMyAdmin is a very slow application if you want to execute a query on your database. If you know the name of the database then any GUI tool is an overhead. So I have written a one liner shell script to do that for me 🙂

Here’s the script:

echo ”select * from table where field like ”%$1%””|mysql -h doamin.com -u amit -p -D amit -r –password=hello

When run with one argument it will execute the sql query directly without asking for password also.

Continue reading

shell — one liner to selectively change case

2010-01-07 2 min read Bash

Today I had a hard time, I had a herculian task of converting the case of file to upper case. Well that’s not difficult :), I know. What made it difficult was the fact that not the whole file had to be converted but only selective lines containing the work important. Okay now that too is not so difficult, I thought. But again the file size was huge, it had some 9 million lines. So, I just thought of trying my skills of shell programming (dont have much of it anyway). So here’s what I did:

Continue reading

feh – versatile image viewer works from command line too.

2009-11-21 2 min read Fedora Linux

To install :

sudo yum install feh

From the info for the feh package:

feh – versatile image viewer works from command line too
premier image file handling library. feh has many features,
from simple single file viewing, to multiple file modes using
a slideshow or multiple windows. feh supports the creation of
montages as index prints with many user-configurable options.

One of the reasons, I install feh as one of the first packages on any installation is the reason that it can open multiple images like in stack. To make things even more simpler I create a alias like this:

Continue reading
Newer posts