From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f8c9b,e5cab0a42c76da9f X-Google-Attributes: gidf8c9b,public X-Google-Thread: fee84,e5cab0a42c76da9f X-Google-Attributes: gidfee84,public From: mbeattie@sable.ox.ac.uk (Malcolm Beattie) Subject: Re: grep to == vms search/window ?? Date: 1995/08/03 Message-ID: <3vqe9j$5g7@news.ox.ac.uk>#1/1 X-Deja-AN: 107426001 references: <3vormk$18g@expert.cc.purdue.edu> organization: Oxford University, England newsgroups: comp.unix.osf.osf1,comp.unix.questions In article <3vormk$18g@expert.cc.purdue.edu>, The Artist wrote: >i'm running dec osf v3.2a > >i'm trying to make the grep command act similary to >the vms *search foo.bar string/window=(3,3)*. and >ideas? it would allow me to search the file foo.bar >for the string *string*. then, if it finds it, >it would display the line containing the string AND >three lines directly above it, and three lines >directly below it. any help? Use GNU grep instead: the option -3 displays 3 lines either side of each match. If you want an asymmetric window then you can use, e.g., -A 4 -B 5 to display 4 lines after and 5 lines before each match. You'll also find that in its "fixed string" incarnation, it doesn't have the same bugs as the fgrep supplied in OSF/1 3.0. It might be fixed in 3.2c but I doubt it. % echo abacababacababc | fgrep abacababc % echo abaabaac | fgrep abaac % (actually these and similar bugs are present in most BSD and SysV fgreps but, interestingly, they have different bugs. OSF/1 shows the same bug as the SysV fgrep whereas Ultrix shows the same bug as the BSD one.) --Malcolm -- Malcolm Beattie Oxford University Computing Services "Widget. It's got a widget. A lovely widget. A widget it has got." --Jack Dee