Skip to content

Pull Output from read_channel to use in another command #2715

Answered by ktbyers
m1ndn1nj4 asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, just get the result back from the first show command; parse the output to extract the interface. Then use some form of f-strings or .format() method to generate the next command using the interface you saved in the previous command.

For parsing, you can look at regular expressions or just a straight .split() call and extract the first field. In other situations, you can use TextFSM or Genie, but those solutions probably won't work here.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@m1ndn1nj4
Comment options

@m1ndn1nj4
Comment options

Answer selected by m1ndn1nj4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants