Skip to content

Instantly share code, notes, and snippets.

@jappy
Created March 11, 2012 08:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jappy/2015517 to your computer and use it in GitHub Desktop.
Save jappy/2015517 to your computer and use it in GitHub Desktop.
grep examples
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