Untitled
public text v1 · immutable#!/bin/bash
if [ -n "$3" ]
then
cat $1 | grep -A+4 -B+2 $2 -n > grepscript.tmp
cat $1 | grep $3 -n >> grepscript.tmp
sort -d grepscript.tmp > grepscript.log
rm grepscript.tmp
cat grepscript.log
else
echo grepscript FILENAME SEARCHWORD1 SEARCHWORD2
fi