Sometimes, we may have a bunch of empty directories left behind by certain scripts or programs. The below command allows us to get rid of these.
find <path-parent> -empty -type d -delete
eg. find . -empty -type d -delete
Sometimes, we may have a bunch of empty directories left behind by certain scripts or programs. The below command allows us to get rid of these.
find <path-parent> -empty -type d -delete
eg. find . -empty -type d -delete
So, every now and then you may want to have a table or some sql query as a csv or excel file to be able to do certain tasks like graphing etc.
Here a quick way to get that.
mysql -h Host -uUser -pPassword -D Database -e 'sql query;' | sed "s/'/\'/;s/\t/\",\"/g;s/^/\"/;s/$/\"/;s/\n//g" >MyFile.csv
Continue reading “How to create a csv or excel file from a mysql query”
So,
Every now and then one runs into a situation where one has an idea of a column of a MySQL table.
A quick way to narrow down on the list of tables is to do a search using the part of the column name that one remembers.
SELECT DISTINCT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME LIKE "%string%";
Where “string” is the string one is searching for.