Feb 8, 2006 #1 ozi403 Technical User Apr 29, 2002 54 TR How can I get 20 lines before this line "dublicate or pick name"? Thanks.
Feb 8, 2006 #2 feherke Programmer Aug 5, 2002 9,541 RO Hi Code: grep -B 20 "dublicate or pick name" /path/to/file Feherke. http://rootshell.be/~feherke/ Upvote 0 Downvote
Feb 8, 2006 #3 PHV MIS Nov 8, 2002 53,708 FR awk ' /dublicate or pick name/{for(i=20;i;--i)print a[(NR-i)%20];exit} {a[NR%20]=$0} ' /path/to/input >output Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886 Upvote 0 Downvote
awk ' /dublicate or pick name/{for(i=20;i;--i)print a[(NR-i)%20];exit} {a[NR%20]=$0} ' /path/to/input >output Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886