Created
March 11, 2012 08:02
-
-
Save jappy/2015517 to your computer and use it in GitHub Desktop.
grep examples
This file contains hidden or 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 '[A–Z]' #lines with an uppercase char | |
grep 'ˆ[A–Z]' #lines starting with an uppercase char | |
grep '[A–Z]$' #lines ending with an uppercase char | |
grep 'ˆ[A–Z]*$' #lines with all uppercase chars | |
grep '[aeiouAEIOU]' #lines with a vowel | |
grep 'ˆ[aeiouAEIOU]' #lines starting with a vowel | |
grep '[aeiouAEIOU]$' #lines ending with a vowel | |
grep –i '[aeiou]' #ditto | |
grep –i 'ˆ[aeiou]' | |
grep –i '[aeiou]$' | |
grep –i 'ˆ[ˆaeiou]' #lines starting with a non-vowel | |
grep –i '[ˆaeiou]$' #lines ending with a non-vowel | |
grep –i '[aeiou].*[aeiou]' #lines with two or more vowels | |
grep –i 'ˆ[ˆaeiou]*[aeiou][ˆaeiou]*$' #lines with exactly one vowel |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment