how to grep
On Fri, 4 Aug 2017 10:33 pm, Iranna Mathapati wrote:
> Hi Team,
> How to grep values from below out put string.
> pattern should include "Fabric Module".
> grepping Fabric module values only
> str = '''
> 22 0 Fabric Module J8N-C9508-FM ok
> 24 0 Fabric Module J8N-C9508-FM ok
> 26 0 Fabric Module J8N-C9508-FM ok
> 22 0 16-slot Fabric Module J8N-C9516-FM-E ok
> 24 0 16-slot Fabric Module J8N-C9516-FM-E ok'''
> output = [22,24,26,22,24]
output = int(line[:2]) for line in string.split('\n') if line]
Does that help?
If not, you will need to ask a better question, because I cannot understand the
question you are asking now.
?Cheer up,? they said, ?things could be worse.? So I cheered up, and sure
enough, things got worse.