To read timestamp and count from a line

I have file like:

Date and Time: 2013-05-11 12:23:12 MST
abc,1234,hi-all,45354-88888,IN,US
XYZ,1234,hi-all,45354-88888,OUT,GB
abc,1234,hi-all,45354-88888,IN,AS
abc,1234,hi-all,45354-88888,OUT,US
abc,1234,hi-all,45354-88888,IN,US
Number of Records: 000005

And i want to read the Timestamp from first line and count from the last line.

please help me out

$ awk 'NR==1{T=$(NF-2)" "$(NF-1)}END{print T,$NF}' file
2013-05-11 12:23:12 000005
sed -n '/^Date\|^Number/p' file
$ sed -n -e "s/Date and Time: \(.*\) MST/\1/p" -e "s/Number of Records: *//p" input
2013-05-11 12:23:12
000005
1 Like

I have to read only the date from the first line. => 2013-05-11

Please help me out

awk 'NR==1 {f=$4} {l=$NF} END {print f,l}' input
2013-05-11 000005

A variation of Hanson44's solution:

sed -n 's/Date and Time: \(.*\) \(.*\) .../\1/p;s/Number of Records: *//p' infile