Feb 8, 2006 #1 ozi403 Technical User Joined Apr 29, 2002 Messages 54 Location TR How can I get 20 lines before this line "dublicate or pick name"? Thanks.
Feb 8, 2006 #2 feherke Programmer Joined Aug 5, 2002 Messages 9,541 Location 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 Joined Nov 8, 2002 Messages 53,708 Location 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