Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!uwm.edu!psuvax1!news From: flee@cs.psu.edu (Felix Lee) Newsgroups: comp.unix.wizards Subject: Re: Word-oriented GREP Message-ID: Date: 29 Apr 91 08:21:03 GMT References: <1991Apr15.014626.28903@berlioz.nsc.com> <1991Apr15.044312.27326@iwarp.intel.com> <73515@eerie.acsu.Buffalo.EDU> Sender: news@cs.psu.edu (Usenet) Distribution: na Organization: /home/staff/flee/.organization Lines: 19 Nntp-Posting-Host: dictionopolis.cs.psu.edu >why not cut down your search space by using grep to find the lines with >the matching patterns and then using perl, or some other unix tool to grab >the pattern.... from the previous example you could do: >grep V\[0-9\]\[0-9\]\[0-9\] fred.c | tr ' ' \012 | grep V\[0-9\]\[0-9\]\[0-9\] Well, yes, you can do that if you want a word-oriented grep. My point was, I don't want a word-oriented grep. I don't want a line-oriented grep either. I want a character-oriented grep, a grep that will just grab matching substrings from an arbitrarily stream. And from this tool you can do word-oriented or line-oriented or whatever-oriented grepping. With the current line-oriented grep, you cannot search for a pattern that spans lines. Say you want to find occurrences of "the dog" in a file, where the words can be separated by any whitespace, including newlines. You cannot do this easily with existing tools. -- Felix Lee flee@cs.psu.edu