Examples:
# Search recursively for 'User' in file contents under current directory
grep -r 'User' .
# Search recursively for 'User' in file contents under current directory and display 2 lines before and after
grep -r -2 'User' .
# Search recursively for 'User' in file contents under current directory and display 2 lines before and after with color
grep -r -2 --color 'User' .
# Search for filenames that contains user.
find . -name 'user.*'
Combine them together:
grep -r -2 --color 'User' $(find . -name 'user.*')
No comments:
Post a Comment