Bo Morris <crushe...@gmail.com> Wrote in message: (Thanks for starting a new thread when asking a new question. But please use text mode in your emails, not html.)
For the first version, write it as a filter, and pipe the two commands together in the shell. So all you have to do is read a line from stdin, parse it, and conditionally write it to std. You don't provide a spec, just a short sample of data. So I'll have to guess that the leading whitespace is irrelevant and the first two fields cannot contain whitespace, and that each contain at least one non-whitespace character. Further that the fields are delimited by whitespace. So, use lstrip to get rid of leading junk, and split to split the line into fields. Then subscript into the resulting list to get the appropriate field. And use startswith to check the desired 3 character string. Notice that you don't just want to use "25", or you might accept an ip like 251.12.3.6 That still leaves you to deal with reporting invalid files, such as those with short or blank lines. -- DaveA _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor