Forum Discussion
- qe_102628Nimbostratus
grep works on a linefeed boundary, whereas the tmsh output contains multiple lines.
While you can't do this in tmsh since the grep doesn't support -A there, you could use something like this on the command line:
tmsh show ltm virtual|grep ^Ltm:: -A5|grep -e 'Ltm::\|\ \ Availability\|\ \ State'
here's me running that: [root@snk-5:Active:Standalone] config tmsh show ltm virtual|grep ^Ltm:: -A5|grep -e '^Ltm::\|^\ \ Availability\|^\ \ State' Ltm::Virtual Server: next4p81 Availability : unknown State : enabled Ltm::Virtual Server: next4p82 Availability : unknown State : enabled Ltm::Virtual Server: next6p81 Availability : unknown State : enabled Ltm::Virtual Server: next6p82 Availability : unknown State : enabled [root@snk-5:Active:Standalone] config
- Sreenivasa_PNimbostratus
how to read before and after line like in v10 we have command -a5 or -b5 but its not working in v11
- Sreenivasa_PNimbostratus
how to read before and after lines like in v10 we have command -a5 or -b5 but its not working in v11
- Mubasher_SultanNimbostratus
That's cool :)
But, please let me know that how to filter some of the VS having string e.g., "to2" and display as above but not all...
Regards, Mubasher
- qe_102628Nimbostratus
Substitute where I use ^Ltm:: with "to2" (in both greps) to accomplish that.
Here's my example where I've modified the grep statements to show only virtuals with "p82" in the name: [root@snk-5:Active:Standalone] config tmsh show ltm virtual|grep p82 -A5|grep -e 'p82|\ \ Availability|\ \ State'