mysql output to an array for easy parsing.

2011-05-11 2 min read Bash Database

 

Today I was looking for some way to put the output of the mysql output in an array in a bash script. Quick google search yeilded to results something like this:

 

  <td>
    <div class="text codecolorer">
      output=$(mysql -e "select * from table")
    </div>
  </td>
</tr>
1

The problem with the above approach is that all the words go into separate index. So if you have a line that has space then that is split into multiple index’s. Not good…

Continue reading

analyze debug queries output for wordpress

2011-02-09 2 min read Wordpress

Some time back, my website became too slow and I started getting timeout response for quite a lot of my pages. When I analyzed things, I found the issue was with the DB queries taking a lot of time. So, I thought of getting my hands dirty and started with installing the plugin “Debug Queries”. Just in case, you don’t know about the plugin, it lists all the queries to DB along with the time taken for the query when a Admin user visits any page.

Continue reading

find duplicate entry in a list in bash with sed

2010-06-25 1 min read Bash Fedora Learning

Here I will take an example of rss2email list, but I guess I will be able to pass on the concept.

Here is example of the output of the r2e list command:

1: http://blog.amit-agarwal.co.in/feed (default: amitag@localhost)
2: http://feeds2.feedburner.com/AllAboutLinux (default: amitag@localhost)
3: http://feeds2.feedburner.com/Command-line-fu (default: amitag@localhost)
4: http://blogs.members.freewebs.com/Members/Blogs/viewBlogRSS.jsp?userid=29731143 (default: amitag@localhost)

Target here is to get the list of all duplicate entries if any. So, first we need to remove the numbers from the begining and the email ID from the end.

Continue reading

Oracle GUI client on Linux with mysql support

2010-06-22 1 min read Fedora Linux

I was looking for some nice client for Oracle and mysql. I did find mysql-administrator and navicat to be useful but this is much better. <a href="http://sourceforge.net/projects/tora/" target="_blank">Tora is the client that I am talking about. Installation did not take much time for me..

downloaded the instant client from oracle.com and then the tora rpm from sourceforge.net. Also downloaded the tora-mysql from http://rpm.pbone.net/index.php3/stat/21/year/2002/month/01/day/28

Then tried to install all the rpms found the rpms that were missing and installed them using yum. Once this is done install the downloaded rpms with &#8221;–nodeps&#8221; option of rpm.Put the entries in bashrc

Continue reading

SQuirrel SQL for Graphical interface to Oracle/MySQL and loads of other database -- OSS and free.

2010-06-04 1 min read Linux

<a href="http://blog.amit-agarwal.co.in/category/linux/">Bookmark this category

SQuirrel <a class="zem_slink freebase/en/sql" title="SQL" rel="wikipedia" href="http://en.wikipedia.org/wiki/SQL">SQL for <a class="zem_slink freebase/en/graphical_user_interface" title="Graphical user interface" rel="wikipedia" href="http://en.wikipedia.org/wiki/Graphical_user_interface">Graphical interface to Oracle/MySQL and loads of other <a class="zem_slink freebase/en/database" title="Database" rel="wikipedia" href="http://en.wikipedia.org/wiki/Database">database — <a class="zem_slink freebase/en/open_sound_system" title="Open Sound System" rel="homepage" href="http://www.opensound.com/">OSS and free.

<a class="zem_slink freebase/en/squirrel_sql_client" title="SQuirreL SQL Client" rel="homepage" href="http://www.squirrelsql.org/">SQuirreL SQL Client is a graphical SQL client written in <a class="zem_slink freebase/guid/9202a8c04000641f800000000f8545aa" title="Java (programming language)" rel="homepage" href="http://java.sun.com">Java that will allow you to view the structure of a <a class="zem_slink freebase/en/java_database_connectivity" title="Java Database Connectivity" rel="wikipedia" href="http://en.wikipedia.org/wiki/Java_Database_Connectivity">JDBC compliant database, browse the <a class="zem_slink freebase/en/data" title="Data" rel="wikipedia" href="http://en.wikipedia.org/wiki/Data">data in tables, issue SQL commands etc. The pre-requisites are java 1.5 and 1.6 in the sequence of the <a class="zem_slink freebase/en/installation" title="Installation (computer programs)" rel="wikipedia" href="http://en.wikipedia.org/wiki/Installation_%28computer_programs%29">installer versions! Installers available at: <a href="http://sourceforge.net/projects/squirrel-sql/files/">http://sourceforge.net/projects/squirrel-sql/files/ Home page and installation instructions at: <a href="http://www.squirrelsql.org/#installation">http://www.squirrelsql.org/#installation Have a nice time with the SQuirreL!!<h6 class="zemanta-related-title">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="http://blog.amit-agarwal.co.in/2010/04/27/fvwm-look-and-feel-icons-and-themes/">fvwm Look and Feel, icons and themes (amit-agarwal.co.in) <li class="zemanta-article-ul-li"><a href="http://checkedexception.blogspot.com/2010/03/using-ms-sql-from-linux.html">Using MS SQL from Linux (checkedexception.blogspot.com) <li class="zemanta-article-ul-li"><a href="http://briancarper.net/blog/adminer-where-have-you-been-all-my-life">Adminer, where have you been all my life? (briancarper.net) <li class="zemanta-article-ul-li"><a href="http://helpdeskgeek.com/databases/an-introduction-to-oracle-sql-developer-part-v/">An Introduction to Oracle SQL Developer – Part V (helpdeskgeek.com) <div class="zemanta-pixie"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/6c1be63c-1479-4ac2-9707-3e8c8b750585/"><img class="zemanta-pixie-img" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/reblog_b12.png" alt="Reblog this post [with Zemanta]" /><span class="zem-script more-related more-info pretty-attribution paragraph-reblog">

Continue reading
Older posts Newer posts