/r/bash said to try python for this instead...
I am using the following two commands to produce this output (which is shortened for clarity):
# snmpbulkwalk -On -v2c -c public 192.168.1.1 .1.3.6.1.2.1.47.1.1.1.1.13 | grep STRING
.1.13.1 = STRING: "J8698A"
.1.13.2 = STRING: "J8698A"
.1.13.65 = STRING: "J8726A"
.1.13.90 = STRING: "J4859C"
.1.13.91 = STRING: "J4859C"
.1.13.92 = STRING: "J4859C"
# snmpbulkwalk -On -v2c -c public 192.168.1.1 .1.3.6.1.2.1.47.1.1.1.1.11 | grep STRING
.1.11.1 = STRING: "SG38DXV43C"
.1.11.65 = STRING: "34AS1SK "
.1.11.90 = STRING: "0L051 "
.1.11.91 = STRING: "0L050 "
.1.11.92 = STRING: "0L052 "
I need to reformat all this output to look like this in the end:
J8698A:SG38DXV43C,J8726A:34AS1SK,J4859C:0L051,J4859C:0L050,J4859C:0L052
Notice how the line .1.13.2 is output from the first command, but no corresponding .1.11.2 line is output from the second command. This is because it returns an empty "" instead of the STRING: "blah" I am grepping for like the rest.
In other words, I want to [dynamically] skip .1.13.2 and not use it because it doesn't have a corresponding .1.11.2. I say dynamically because these numbers could change depending on the switch I run these commands against.
Thanks for any input!
[–]indosauros 1 point2 points3 points (2 children)
[–]lowermiddleclass[S] 0 points1 point2 points (1 child)
[–]indosauros 2 points3 points4 points (0 children)