unix$ sed 's/^M//g' -i myfile.txtNOTE: type CTRL-V CTRL-M for the pattern inside '/s/^M//g'. The above sed pattern deletes all occurrence of ^M and saves it on the same file using the -i argument.
Monday, October 22, 2012
Removing trailing dos carriage returns ^M
Sometimes when you're comparing text files, the lines looks identical but the diff command shows that the two lines are different. One reason might be because one file has dos carriage returns (^M) and the other doesn't. One easy way to check this is by opening the file using VI, ^M will show up at the end of the lines as shown:
There are several ways of removing this dos carriage return, but my preferred tool is sed. I had a problem getting sed to substitute this because you need to actually type CTRL-V CTRL-M when writing the regular expression.
Tuesday, October 16, 2012
MYSQL: How to get the summary of tables in a DB
I sometimes want to see the number of rows in the tables of my DB. Instead of using COUNT for each table, use this command to get the summary of your database.
mysql> show table status;Results: +----------------------------------------+--------+---------+------------+-------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-------------------+----------+----------------+---------+ | Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time | Update_time | Check_time | Collation | Checksum | Create_options | Comment | +----------------------------------------+--------+---------+------------+-------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-------------------+----------+----------------+---------+ | account_customer | InnoDB | 10 | Compact | 0 | 0 | 16384 | 0 | 0 | 51380224 | 1 | 2012-10-16 12:34:33 | NULL | NULL | latin1_swedish_ci | NULL |
Thursday, September 13, 2012
configure: error: Your intltool is too old.
While installing a new application on Ubuntu 12.04, I got this error when I ran ./configure:
configure: error: Your intltool is too old. You need intltool 0.40.0 or later.
Seems like the error message is a bit inaccurate, you're probably missing this software package. You need to install it using apt-get.
ubuntu12.04$ sudo apt-get install intltool
This should fix the error.
BTW: I encountered this issue when installing a very nice small application called alarm-clock. What I like about it is that it can be set two different ways - a) have an alarm go off at a certain time, or b) have a timer count down. See snapshot below.
configure: error: Your intltool is too old. You need intltool 0.40.0 or later.
Seems like the error message is a bit inaccurate, you're probably missing this software package. You need to install it using apt-get.
ubuntu12.04$ sudo apt-get install intltool
This should fix the error.
BTW: I encountered this issue when installing a very nice small application called alarm-clock. What I like about it is that it can be set two different ways - a) have an alarm go off at a certain time, or b) have a timer count down. See snapshot below.

Friday, August 31, 2012
Useful links
This might be helpful to those that have cut their cable TV.
http://jarkhd.blogspot.com/2011/10/hacking-digital-cable.html
http://jarkhd.blogspot.com/2011/10/hacking-digital-cable.html
Subscribe to:
Posts (Atom)