Thursday, January 31, 2013

Extracting the string between two patterns in a file

Supose the file contains this phrase: That is just a test for you

I need to extract the patterns between the words is and test:


 sed -e 's/.*is//' -e 's/test.*$//' /Path-To-Your-File/yourfile.txt

and the result is:

  just a

Tuesday, January 22, 2013

Find out MySQL Time & Zone

for global and session time zone run this query:


mysql> SELECT @@global.time_zone, @@session.time_zone;


for get current time from MySQL Server run this query:

mysql> select now() ;