Format output from the file to extract "date" section

Hello Team ,

I have to extract date section from the below file output. The output of the file is as shown below.

I have to extract the "[12/14/10 14:43:03:732 CET]" this section from the above output of the file. can anyone please let me know how can we acheive this?

awk 'NR==1{print $1,$2,$3}' SystemOut.log_bak14122010

You could leave out the grep with this:

$> sed -n '/OutOfMemory/ {s/\].*/]/p}' SystemOut.log_bak14122010
[12/14/10 14:43:03:732 CET]
[12/14/10 14:46:15:086 CET]

This is done with GNU sed. If it wont work with your version of sed, you might have to write it like:

$> sed -n '
/OutOfMemory/
{
s/\].*/]/p
}
' SystemOut.log_bak14122010

Hello cabrao,

I have ran the command and i am getting following error in the output

bash-3.00$ awk 'NR==1{print $1,$2,$3}' SystemOut.log_bak14122010
************ Start Display
awk: record `[12/14/10 15:54:22:9...' too long
 record number 6014

---------- Post updated at 09:58 AM ---------- Previous update was at 09:56 AM ----------

Hello zaxxon,

I have ran the command and i am getting following output.

bash-3.00$ sed -n '/OutOfMemory/ {s/\].*/]/p}' SystemOut.log_bak14122010
sed: command garbled: /OutOfMemory/ {s/\].*/]/p}
bash-3.00$

I have written, that if the 1st command does not work, you might try the 2nd command I posted. That's due to different versions of sed.