All pastes #502440 Raw Edit

Untitled

public text v1 · immutable
·published 2007-05-22 14:55 UTC
rendered paste body
#!/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