From: William James Date: 2007-09-19T23:40:04+09:00 Subject: Re: finding string matches, in order, in a file On Sep 19, 7:03 am, Peter Bailey wrote: > I'm getting exactly what you predict. And, . . ., perhaps I haven't made > this clear, but, I am getting healthy output from my script. I'm getting > 208 lines of data. Each line is an entry between the entries > I've described. They're just totally out of order! That's my problem. > Here are the first 5 entries I get back: > Immigration > Health Issues > Copyright/Patent/Trademark > Budget/Appropriations > Health Issues > .. Very odd. "scan" will return the strings in the order that they are found. How did your program read the file? Could its contents have been disordered somehow? After your program reads the file into a string, have it write the string to a temp file and then use fc or diff to compare the 2 files. "Health Issues" appears twice; I presume the file contains two entries. You've probably had your editor do a string search to verify that "Immigration" isn't the first entry in the file.