grep
grep(1) BIG-IP TMSH Manual grep(1)
NAME
grep - Display lines matching a pattern
SYNTAX
list [component] "|" grep [ [option | pattern] ... ]
show [component] "|" grep [ [option | pattern] ... ]
options:
-A [integer]
-B [integer]
-C [integer]
-E
-G
-P
-c
-e [pattern]
-i
-m [integer]
-n
-o
-v
-w
-x Note: Each option must be followed by a space.
Note: tmsh treats any argument that is not preceded by a supported option, and does not begin with a hyphen, as a search
pattern preceded by -e.
DESCRIPTION
You can use grep to filter the output generated by the commands list (configuration settings) and show (statistics and
runtime status). You must type the character | before the grep specification. You can use multiple filters chained
together.
EXAMPLES
The following examples show how to use the grep utility in tmsh.
list ltm node | grep "^10\.2"
list ltm virtual | grep -i seattle
list ltm virtual | grep -i abc | grep -i ab | grep -i a
OPTIONS
-A Display the specified number of lines of context after matching lines.
-B Display the specified number of lines of context before matching lines.
-C Display the specified number of lines of context before and after matching lines.
-E Interpret patterns as extended regular expressions.
-G Interpret patterns as basic regular expressions.
-P Interpret patterns as Perl regular expressions.
-c Display a count of the lines that match. If -v is specified the number of non-matching lines is displayed.
-e Specify a pattern. This is useful to protect against patterns beginning with a hyphen.
-i Case insensitive search.
-m Stop reading input after the specified number of matching lines. If -c is specified the count will not exceed the
value specified for -m. If -v is specified grep will stop after finding the specified number of non-matching lines.
-n Prefix each line of output with the line number relative to the input.
-o Show only the part of a matching line that matches the pattern.
-v Invert the sense of matching, to select non-matching lines.
-w Select only those lines containing matches that form whole words. The test is that the matching substring must
either be at the beginning of the line, or preceded by a non-word constituent character. Similarly, it must be
either at the end of the line or followed by a non-word constituent character. Word-constituent characters are
letters, digits, and the underscore.
-x Select only those matches that exactly match the whole line.
SEE ALSO
list, show, tmsh
COPYRIGHT
No part of this program may be reproduced or transmitted in any form or by any means, electronic or mechanical, including
photocopying, recording, or information storage and retrieval systems, for any purpose other than the purchaser's personal
use, without the express written permission of F5 Networks, Inc.
F5 Networks and BIG-IP (c) Copyright 2009. All rights reserved.
BIG-IP 2017-05-24 grep(1)