Last active
August 29, 2015 13:57
-
-
Save cirocosta/9697164 to your computer and use it in GitHub Desktop.
Outputs the line of the first occurence of a pattern with grep
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
$ grep -n --exclude-dir="node_modules" 'term to be searched for' -r # searches recursively for a term and outputs with line number |
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
$ grep -n 'style="' my-file.html | head -1 | cut -d : -f 1 # outputs just the number | |
$ grep -n 'style="' my-file.html | head -1 # outputs the number and the content found |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment