Script to look for data in a file (not that simple) ...

I'm looking for a script or program that would allow me to pass a pattern to it and give me locations on where text appears in a file. I wish it was that straight forward (I would use egrep or something)

Say I have the word in my text file "SUDAN" but my user does a search for "SUDANESE". Grep doesn't help me. The other way round would work
but I'm dealing with text files that are huge. I'm also looking for something
that could do a "sounds-like" too -- but not a major issue.

Can someone help me out? Is there a program out there or script I can
buy? O/S is SCO.

Thanks!

This you could achieve from a unix shell script.
Pls reach me at (emails not allowed - see the rules ) in case of any assistant.

Regards,
Manish Jha

I think you need to define what you need more precisely.
sudanese maps also to sudan? also to suda? sud?
that doesn't make sense to me.
Location? as in line number?
sounds like perl to me. There is a perl soundex module.

It could be but I'm not very experienced with Perl.
I want to be able to pass a string to a script that would
look for data in a file that looks almost like the string that
was passed.

I pass this string to the script: Smithsonian
Somewhere in my file there is a line: Dobbs Smith

I want to have the script to be able to send the whole line to standard
output. (Kind of like what egrep does)

I have a soundex function in my database. I'm going to use that first
and see what happens.

I would still like to hear if there are some other options as well.
:confused: (If I was able to explain myself clearly)

Thanks!

hmm! methinks this is quite non-trivial.

it's definitely not a shell script!
maybe, if you have a soundex,

  1. get the search string
  2. run the soundex on /usr/dict/words to get a list of possibles
  3. then grep the target data on *that* list

? I think that would be a simple-ish method that may just work.
maybe :wink:

needs work!

#!/usr/bin/perl -ws

use Text::Soundex;

@ARGV = </usr/dict/words>;
@list = <> ;

$search=soundex($search) or die "\n$0 -search=string\n" ;
print "Looking for: $search\n" ;

foreach (@list) {

     print if soundex($_) eq $search;
}
$  soundex.pl -search=smithsonian
Looking for: smithsonian
saints
sands
sandstone
sandwich
sandwiches
scantiest
scents
schematic
schematically
schematics
scientist
scientists
senates
sends
shanties
smiths
smoothes
smoothest
smudge
snatch
snatched
snatches
snatching
snouts
somatic
sonnets
soundest
sounds
syndicate
syndicated
syndicates
syndication
syntactic
syntactical
syntactically
syntax
syntaxes
synthesis
synthesize
synthesized
synthesizer
synthesizers
synthesizes
synthesizing

I'll try it out and see what happens!

Thank you!!!