split command

In Linux you can use split and join commands to split large files into smaller files or join many smaller files into a large file. This kind of operations are often necessary when you are dealing with large quantities of data.


Following is the default functionality of split. It splits a large file every thousand lines and creates new files.

$ split largefile.txt

$ ls
largefile.txt  xaa xab  xac  xad

$ wc -l *
3285  largefile.txt
1000  xaa
1000  xab
1000  xac

You can also define the number of lines you want in each file

Listing all tables and their table counts in a MySQL database

The Following SQL query will list all tables in a MySQL database and also list the row counts for each.

FROM `information_schema`.`tables` 
WHERE `table_schema` = 'mydatabase';

where mydatabase is the name or your database. The output will like something like the following:

| table_name | table_rows |
| lines      |       2271 |
| links      |        484 |
| word       |      25004 |

Perl Quotes and Escape Sequences

Perl string literals are enclosed in quotation marks. You can use either single quotes ('') or double quotes ("").

print "hello";
print 'hello'; 

Now suppose you need to print a string which contains a single or double quote such as following strings:

This is bob's watch.
Alice replied, "It was a birthday gift."

If I do the following,

Pushed changes to GIT but don't see it in repository


You pushed your changes to GIT but you don't see it in the repository.


First thing is to compare status with log

git log

will give you a list of the commits. You will not see your changes here.

git status

You will see your files here. Above the list of files, you will see

Changes to be committed


The reason you don't see your changes in repository is because they were not committed.

Converting to and from epoch time

Epoch time is Unix timestamp which counts the number of seconds since January 1 1970 00:00:00 UTC. Without getting into long discussion, follow is how your convert between human readable date and epoch time.

Convert Human Readable Date to Epoch Time

  $now = strtotime('2010-04-25');
  print $now;

Convert Epoch Time to Human Readable Time

  $human_date=date("Y-m-d", 1251627495);
  print human_date;