Error while extracting data from log file

I am running awk command to extract data from log file to calculate last 15 minutes log using below command and now i am getting bellow error:

awk '$0>=$from' from=$(`date -u +"####<%d-%b-%Y %H:%M:%S o'clock GMT>"-15min`) test.log

Error:

date: 0551-402 Invalid character in date/time specification. Usage: date [-u] [+"Field Descriptors"] awk: 0602-562 Field $() is not correct.  The input line number is 1. The file is test.log.  The source line number is 1.

Can anyone see what the problem is?

One problem is in the incorrect time format in the date command. Another problem is the incorrect dollar sign in the awk part (to refer to a variable in awk you do not use a dollar sign).
First try the date command and check if what it produces is what you were looking for.

yup.. it works fine

echo `date -u +"####<%d-%b-%Y %H:%M:%S o'clock GMT>`
####<04-Mar-2015 10:56:02 o'clock GMT>

Hold on, you left out the -15min part..

If it is OK then try (using your code as an example):

... from="$(date -u +"####<%d-%b-%Y %H:%M:%S o'clock GMT>"-15min)"

which also leaves out the backticks that are not needed here...

----
Please use CODE tags when you post code or data samples..

awk: 0602-562 Field $(####<04-Mar-2015 11:10:45 o'clock GMT>-15min) is not correct.
 The input line number is 1. The file is test.log.
 The source line number is 1.

I am getting the pasted error also it is picking the system's date time not the log file given

See the second sentence in post #2.

--
Also, with your date command I get this output using GNU date:

####<04-Mar-2015 11:16:07 o'clock GMT>-15min

Are you sure that is the output you are looking for?

Many Thanks Scrutinizer.<br>I have a log file which consists of date in this format

##<01-Mar-2015 03:48:18 o'clock GMT> <info>  ##<01-Mar-2015 03:48:20 o'clock GMT> <info> ##<01-Mar-2015 03:48:30 o'clock GMT> <info> ##<01-Mar-2015 03:48:39 o'clock GMT> <info>

and I have to extract the date based on time interval of 15 minutes.This is what I am trying to accomplish. Since I am new to shell scripting, finding it bit tricky<br>

---------- Post updated at 06:32 AM ---------- Previous update was at 06:29 AM ----------

no. I am getting error as pasted above

Are there no newlines in your log file?

OK, let me rephrase that, is the output of the date command that I posted what you are looking for, or if not, what is the output that you are looking for?

Another question: What OS and version are you using?

See also the comments posted in the duplicate thread Extract data from log which may solve your problem. That thread has now been closed to keep other volunteers from wasting their time trying to help you in that thread.

Please just use one thread to discuss a problem.