Skip to content

Instantly share code, notes, and snippets.

@slawomir-siudek
Forked from lavandosovich/grep.md
Created August 1, 2017 09:17
Show Gist options
  • Save slawomir-siudek/2144b89e58d087acf040a5955b6f3c94 to your computer and use it in GitHub Desktop.
Save slawomir-siudek/2144b89e58d087acf040a5955b6f3c94 to your computer and use it in GitHub Desktop.
Grep

Grep

-i - searches for upper && lower cased
-v word - searches every row without word
-n - shows line number of occurence
-E - grep on steroids || egrep

grep -i "..cen" GNU - searches for all ..cen in GNU
grep "t[wo]o" GPL-3 - searches for too && two in GPL-3, because of [wo], which stands for ||
grep -i "[^c]en" GNU - searches for everything '*en' but 'cen'
grep "^[[:upper:]]" GNU - searches for all rows which statrts with uppercase letters.
grep "^[A-Z].*to$" GNU - searches for string which starts with uppercase letter and end with "to"
grep -E "GNU|License" GNU - searches either for 'GNU' or for 'License'
grep -E "(copy)?right" GPL-3 - searches for right or copyright
grep -E "a[^[:space:]]+" GNU - searches for any 'a' begining row without "space"
grep -E "[AEIOUaeiou]{2}" GNU - searches for sicuence(size: 2) of vowels
grep -E "[[:alpha:]]{8,20}" GNU - searches for words which length is BETWEEN 8 AND 20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment