Forum Discussion
9 Replies
- AneshCirrostratus
Have u tried below
tmsh show ltm virtual detail | egrep "Virtual Server: | Destination | Ltm::Pool: | Ltm::Pool Member: " | grep -v "Destination IP Bypasses" | sed 's/Ltm:://g;s/|//g;s/Destination\s*/Destination/g'
- AneshCirrostratus
Tried this in 11.5.x, should work in other version mentioned by you as well, the only change in the command i made is the switch -E
tmsh show ltm virtual detail | grep -E "Virtual Server: | Destination | Ltm::Pool: | Ltm::Pool Member: | Ltm::ClientSSL Profile" | grep -v "Destination IP Bypasses" | sed 's/Ltm:://g;s/|//g;s/Destination\s*/Destination/g'
- f51Cirrostratus
Tried in v13 Getting below error
Syntax Error: "sed", grep is currently the only filter that is supported
egrep and grep -E are same. Its an extended. Lets say you want to search multiple variables in a line or a file (basically an input). You can simply use grep -E "variable1 | variable2 | variable3"
Example:
If a file has the below 5 lines in it.
The file has 4 entries first line second line third line fourth line
#cat file | grep first
first line
#cat file | grep -E "first | second"
first line second line
#cat file | grep line
first line second line third line fourth line
Hope you got the idea.
- RoseAltostratus
I have tried with these 2 commands, but it doesn't give an outpuT after the command is entered. This is on the 12.x.x version
show ltm virtual detail | grep "Virtual Server: | Destination | Ltm::Pool: | Ltm::Pool Member: | IP Address" | grep -v "Destination IP Bypasses" | grep 's/Ltm:://g;s/|//g;s/Destination\s*/Destination/g'
show ltm virtual detail | grep -E "Virtual Server: | Destination | Ltm::Pool: | Ltm::Pool Member: | IP Address" | grep -v "Destination IP Bypasses" | grep 's/Ltm:://g;s/|//g;s/Destination\s*/Destination/g'
- rbenford2311Nimbostratus
You need to redirect to a file to view output.
>> filename
- Jate00Nimbostratus
This may not be the place to ask, but can you tell me what the pipe character enclosed in the quoted sting does?
thanks
- Nathan_F__F5_Employee
Hi Jate00,
I did not write the command but I may be able to help. Are you referring to the pipe character that sits between "Virtual Server:" and "Destination" for example? If you are then I believe that pipe is basically just telling the grep command to search for each of those strings individually.
For example, with the pipe between "Virtual Server:" and "Destination" grep knows to search for "Virtual Server:" and "Destination" separately. Without the pipe between them grep would be searching for "Virtual Server: Destination" as if it were one string instead of two and would not find a match because there is no string that matches "Virtual Server: Destination".
-Nathan F
- Jate00Nimbostratus
Thanks guys, it does make sense now.