cat $filename | ( flag="" while read logline do if echo $logline | grep "pattern" > /dev/null then flag="X" fi if [ "$flag" = "X" ] then echo $logline fi done) | tr a A
Originally posted by Wookie Given a file called test.txt wookie wookie marker hello world hello world run test.com T1=`grep -n marker ./test.txt | cut -f 1 -d : -` T2=`cat test.txt | wc -l` T3=$(($T2 - $T1)) tail -$T3 test.txt > new.txt new.txt should then contain the following hello world hello world I think this does what you need. However it is probably two much of a hack to ever be used.