#!/bin/sh FILE="path to file" START=`grep -n '2014-11-29 04:51:23.253790' "$FILE" | cut -f1 -d:` END=`grep -n '2014-11-29 04:51:23.255933' "$FILE" | cut -f1 -d:` sed -n "$START,$END p" $FILE