grep -n 'search_string' /path/to/log/file.log | cut -d: -f1 | xargs -I {} awk 'NR >= {} - 50 && NR <= {} + 50' /path/to/log/file.log | sed -n '1,101p'