Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

need a help on escaping the parenthesis #47

Closed
Rashmi-Nuviso opened this issue Nov 29, 2016 · 3 comments
Closed

need a help on escaping the parenthesis #47

Rashmi-Nuviso opened this issue Nov 29, 2016 · 3 comments

Comments

@Rashmi-Nuviso
Copy link

Hi All ,

can anybody help me how do i escape the paranthesis

my requirement is to pull the X86_64_LINUX_IOSD-UNIVERSALK9-M

from the build from the cisco show version output

Cisco IOS Software, CSR1000V Software (X86_64_LINUX_IOSD-UNIVERSALK9-M),

since textfsm has the definition where most of the pattern we want to fetch it needs to be grouped

if i try like

pattern = ((.*)) to extract the (X86_64_LINUX_IOSD-UNIVERSALK9-M)

the textFSM throws the error .

any help on this will be appreciated .

@GGabriele
Copy link
Contributor

Hi,
you can escape parenthesis with a \. Your pattern would be pattern = (\(.*\))

@itdependsnetworks
Copy link
Contributor

I would have the outside () escaped and not in the capture group and label it a different variable. That being said, it will be easiest to see the full output.

@Rashmi-Nuviso
Copy link
Author

pasting the solution suggested by Ken here for others who are would like pull the build X86_64_LINUX_IOSD-UNIVERSALK9-M from the line

Cisco IOS Software, CSR1000V Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 15.5(3)S2, RELEASE SOFTWARE (fc2)

of the show version command

^.*Software\s.*\(${BUILD}\),\sVersion\s${VERSION},*\s+RELEASE.*

Closing this issue .

Thanks Ken :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants