Forum Discussion
How to use Grep command to identify the particular VS and their state?
Hi Folks,
I want to identify the VS servers having the string e.g., TO2 and their "Availability" or "State"
I am using the below command
show /ltm virtual all-properties | grep -i "to2" ---> It works fine... show /ltm virtual all-properties | grep -i to2 | grep Availability ---> Doesn't work show /ltm virtual all-properties | grep -i to2 | grep State ---> Doesn't work
Please help or any advise...
5 Replies
- qe_102628
Nimbostratus
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_P
Nimbostratus
how to read before and after line like in v10 we have command -a5 or -b5 but its not working in v11
- Sreenivasa_P
Nimbostratus
how to read before and after lines like in v10 we have command -a5 or -b5 but its not working in v11
- Mubasher_Sultan
Nimbostratus
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_102628
Nimbostratus
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'
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com