This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Show grep version | |
grep --version | |
# Print lines containing sys | |
grep sys /etc/passwd | |
# Print lines containing SYS case insensitive | |
grep SYS -i /etc/passwd | |
# Count lines containing sys | |
grep -c sys /etc/passwd | |
# Print last 10 lines containing sys | |
tail -10 /etc/passwd | grep sys | |
# Print lines fullfilling regex (put regex in single quotes) | |
grep '^[a-z]' /etc/passwd | |
# Print non empty lines | |
grep -v '^$' /etc/passwd | |
# Print 2 lines after the match (including the match) | |
# use B instead for before, C for before and after | |
grep proxy -A2 /etc/passwd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment