|
Joined: Dec 2002
Posts: 204
Fjord artisan
|
OP
Fjord artisan
Joined: Dec 2002
Posts: 204 |
Hi, I am trying to $read from a text file which has lines like this:
"50479","+43.077155","-093.312569","THORNTON","IA","CERRO GORDO","STANDARD" "00604","+18.493520","-067.135883","AGUADILLA","PR","AGUADILLA","STANDARD"
when i try reading a random line from the file, it works perfectly, but when i try /echo -a $read(file.txt,S,"50479") mirc returns * /echo: insufficient parameters. What i eventually want to do is parse the line from the text file and use the parsed line in a socket script. Can someone tell me what i am doing wrong?
keek: Scots - intr.v. keeked, keek·ing, keeks To peek; peep.
|
|
|
|
Joined: May 2006
Posts: 93
Babel fish
|
Babel fish
Joined: May 2006
Posts: 93 |
try /echo -a $read(file.txt,s,"50479") instead of /echo -a $read(file.txt,S,"50479")
if it doesn't work maybe is a problem of "" in "50479"...
|
|
|
|
Joined: Dec 2002
Posts: 204
Fjord artisan
|
OP
Fjord artisan
Joined: Dec 2002
Posts: 204 |
still wont work, i have tried all the types of $read that i can remember (with and without quotes, wildcards, and both S and s. If i cannot find an easy way to read the liine, i will have to convert the zipcodes.txt file to an ini file, and i have no way of doing that easily without $read, other than retypeing the whole file, and that is a task I do not want to undertake because there are over 42,000 lines in the file. Any and all help would be appreciated.
keek: Scots - intr.v. keeked, keek·ing, keeks To peek; peep.
|
|
|
|
Joined: Jan 2003
Posts: 2,523
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,523 |
The s switch makes $read() look for a line that begins with the specified word(s). "50479" is not a word because it's not separated from the rest of the line by a space but by a comma.
Use the w switch instead: //echo -a $read(file.txt,w,"50479"*)
/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
|
|
|
|
Joined: Jan 2004
Posts: 2,127
Hoopy frood
|
Hoopy frood
Joined: Jan 2004
Posts: 2,127 |
try /echo -a $read(file.txt,s,"50479") instead of /echo -a $read(file.txt,S,"50479")
The capital S returns the first line text, but it also does that even if I do: //echo -a $read(file.txt,S,xyz) From mirch.hlp, small-s "Scans the file info.txt for a line beginning with the word your_word and returns the text *following* the match value." Since your line has no spaces in it, then there's no following word to find. If you put the entire line#1 into a %variable, and then did: //echo -a $read(file.txt,s,%variable) . $readn ... you will see that even without returning the text, it did identify the correct line. Perhaps you should instead use: //echo -a $read(file.txt,w,"50479"*)
|
|
|
|
Joined: Dec 2002
Posts: 204
Fjord artisan
|
OP
Fjord artisan
Joined: Dec 2002
Posts: 204 |
holy crimeny qwerty, nowi see why the made you a mod here works perfectly, thank you very much
keek: Scots - intr.v. keeked, keek·ing, keeks To peek; peep.
|
|
|
|
|