in reply to Re: extraction of data
in thread extraction of data
Consider the following points. You search the entire line, rather than the artist name, example data:
Seamus McGuire:The Wishing Tree:09-14-2000:14.95 Foo:Bar:01-01-2000:15.00 Bar:Baz:01-01-2000:150.00
Searching for Bar:
Entery Either First or Last name of the artist:-1 to quite>Bar Artist Name:Foo CD title:Bar Date:01-01-2000 Price:$15.00 Artist Name:Bar CD title:Baz Date:01-01-2000 Price:$15.00 Entery Either First or Last name of the artist:-1 to quite>
To resolve this split the line into individual fields and match on the artist name only. You could also remove the $flag variable and just add an else to your if. Note that currently your searches are case sensitive. I know OP was not very specific when posting, but many people tend not to consider case to when using search interfaces. A slightly amended prompt:
print "Enter either First or Last name of the artist:-1 to quit> ";
Now here's the interesting part, restart the program and search for "Bar" twice:
Entery Either First or Last name of the artist:-1 to quite>Bar Artist Name:Foo CD title:Bar Date:01-01-2000 Price:$15.00 Artist Name:Bar CD title:Baz Date:01-01-2000 Price:$150.00 Entery Either First or Last name of the artist:-1 to quite>Bar Artist not found Entery Either First or Last name of the artist:-1 to quite>
I'll leave this as an excercise for you :)
Update: Strike out nonsense, the pitfalls of my poor multi tasking.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: extraction of data
by vinoth.ree (Monsignor) on May 14, 2014 at 16:00 UTC |