On Mon, May 23, 2005 at 04:17:44PM -0500, Colin Ingram wrote: > (...) > > this creates a file that looks like this: > 00:00.000, 3.24557e+007 > 00:02.510, 3.23482e+007 > 00:05.007, 3.24578e+007 > 00:07.507, 2.77091e+007 > ---snip--- > > I now need to covert the "elapse time" column from the string format > "hours:min:sec" to a column containing just seconds. I am unsure how to > do this. Can I use command substitution in a sed substitute command?
You could pipe the output of your script through the following perl command: ... | perl -pe 's/^(\d+):(\d+):(\d+)/$1*60**2 + $2*60 + $3/e' in case the time string represents "hours:min:sec". If it's "min:sec.msec" (looks like it to me...), then it'd be ... | perl -pe 's/^(\d+):([\d.]+)/$1*60 + $2/e' The s///e option requests command subtitution, where the value can be any perl code, the result of which will be the replacement string. I'm not saying it cannot be done in sed, I just don't know how -- from the top of my head. And it'd probably not be easier... :) Almut -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]