Bob La Quey
robertl1 at home.com
Wed Jul 5 03:23:21 CDT 2000
If in fact your data always looks like
[ ID] Interval Transfer Bandwidth
[ 4] 0.0-25.0 sec 188 MBytes 60.2 Mbits/sec
[ 6] 0.0-25.0 sec 277 MBytes 88.5 Mbits/sec
[ 5] 0.0-25.0 sec 112 MBytes 35.7 Mbits/sec
[ 3] 0.0-25.0 sec 195 MBytes 62.4 Mbits/sec
[ 5] 25.0-50.0 sec 196 MBytes 62.7 Mbits/sec
Then you should blow of any complex splits or regexes,
which Perl gurus become fixated upon and,
1) Just parse the columns by character widths and
2) then clean up fore and aft extra spaces, if that is important.
The resulting code will be
1) Obvious and
Check out the standard C function scanf
for a model of how to do this. Then translate to
Or simpler yet just treat the lines as char arrays
and slice off the relevant pieces.
Please don't make your problem more complicated than it is.
taa0 at cris.com wrote:
Here's one more way. Not very pretty, but it illustrates some ideas from the
"Mastering Regular Expressions" book:
There has to be a better way. I can only agree with the author
taa0 at cris.com when I look at the code he provided, "not very pretty".
There are many reasons to write code. I would be quite surprised if
illustrating ideas from the "Mastering Regular Expressions" book.
</quote> is why Steve Meier is writing this code. I suspect he
has a simple and pragmatic reason to do so.
Why not give him a simple and pragmatic solution?
I would do so but it is past 1:00 AM in the morning,
and I am 58 years old and have been writing code way too
long (nearly 40 years) to do this for you. Pardon me if
this sounds arrogant but I am a bit tired and feeling
like a curmudgeon.
Now I shall sleep and leave others to pick up the rant.
Exercise for the students, get to work,
Bob La Quey
The posting address is: san-diego-pm-list at hfb.pm.org
List requests should be sent to: majordomo at hfb.pm.org
If you ever want to remove yourself from this mailing list,
you can send mail to <majordomo at happyfunball.pm.org> with the following
command in the body of your email message:
If you ever need to get in contact with the owner of the list,
(if you have trouble unsubscribing, or have questions about the
list itself) send email to <owner-san-diego-pm-list at happyfunball.pm.org> .
This is the general rule for most mailing lists when you need
to contact a human.
More information about the San-Diego-pm