[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [seul-edu] Re: perl or......



On Sun, Dec 03, 2000 at 11:11:14AM +0000, Thomas TEMPE wrote:
> > I would like to be able to check some books for root words.
> > 
> > Example.... look for occurances of ped, cor, cit, in swift.txt
> 
> What about grep? It's a common unix command for finding regular expressions in
> files.
> Try typing "grep ped swift.txt"
 
You may find it more useful to grep \\\bped swift.txt

the \\\b gets translates by the shell to \b, which means "with a word
break here". Thus grep would pick out instances of 'ped' at the beginning
of words, but wouldn't pick out things like 'torpedo' or 'biped'.

Each has its place.

I think grep "\bped" swift.txt should work equivalently, depending on
your shell.

(This \b thing works in perl regexps, too.)

--Roger