Editing Grep
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 4: | Line 4: | ||
<code>~/.[[bash_profile]]</code> | <code>~/.[[bash_profile]]</code> | ||
− | :<code>alias grep=' | + | :<code>alias grep='grep --color=auto'</code> |
== Common options == | == Common options == | ||
− | :<code> | + | :<code>-o, --only-matching</code> |
:<code>-a, --text equivalent to --binary-files=text</code> | :<code>-a, --text equivalent to --binary-files=text</code> | ||
− | |||
− | |||
− | |||
− | |||
== Examples == | == Examples == | ||
− | |||
− | |||
− | |||
Search for a pattern: TEXT="OTHER_TEXT" | Search for a pattern: TEXT="OTHER_TEXT" | ||
* <code>[[grep -o]] 'TEXT="\w*"' index.html</code> | * <code>[[grep -o]] 'TEXT="\w*"' index.html</code> | ||
Line 30: | Line 23: | ||
* <code>grep your-search[[$]]</code> | * <code>grep your-search[[$]]</code> | ||
− | + | Add line: | |
* {{add line}} | * {{add line}} | ||
Line 47: | Line 40: | ||
== Related == | == Related == | ||
* <code>[[findstr]]</code> ([[Windows]]) | * <code>[[findstr]]</code> ([[Windows]]) | ||
− | |||
* [[include (Cisco IOS)]] | * [[include (Cisco IOS)]] | ||
− | |||
* <code>[[ag]]</code> | * <code>[[ag]]</code> | ||
* <code>[[git grep]] "your_string" $([[git rev-list --all]])</code> | * <code>[[git grep]] "your_string" $([[git rev-list --all]])</code> | ||
Line 56: | Line 47: | ||
* <code>[[psql -c]]</code> | * <code>[[psql -c]]</code> | ||
* <code>[[pkill -x]]</code> | * <code>[[pkill -x]]</code> | ||
− | |||
* [[Logs]]: [[ElasticSearch]] and [[OpenSearch]] | * [[Logs]]: [[ElasticSearch]] and [[OpenSearch]] | ||
− | |||
<pre> | <pre> | ||
[[:alpha:]] | [[:alpha:]] |
Advertising: