擅长:python、mysql、java
<p>如果将其包装在filecontext中,则可以实现以下操作:</p>
<pre><code>f = [
"2011-223-18:31:11.737 VWR:tao abc exec /home/abcd/abcd9.94/bin/set_specb.tcl -s DL 2242.500000 5",
"2011-223-18:31:11.737 > -20.000000 10",
"2011-223-17:40:07.039 EVT:703 agc_drift_cal.tcl: out of tolerance drift of 5.3080163871 detected! Downlink Alignmen",
"2011-223-17:40:07.039 >t check required.",
]
import re
wrapped_line = "\d{4}-\d{3}-\d{2}:\d{2}:\d{2}\.\d{3} *>(.*$)"
result = [""]
for line in f:
thematch = re.match(wrapped_line,line)
if thematch:
result[-1] += thematch.group(1)
else:
result.append(line)
print result
</code></pre>