Grep Flashcards
show lines with keyword “accord”
grep ‘accord’ cars.txt
ignore case sensitivity and show keyword “accord”
grep -i ‘accord’ cars.txt
ignore cases and show line numbers and show keyword “accord”
grep -in ‘accord’ cars.txt
show lines WITHOUT keyword “accord”
grep -v ‘accord’ cars.txt
count how many lines contain keyword “chevy”
grep -c ‘chevy’ cars.txt
show lines with numbers 5-7
grep ‘[5-7] cars.txt’
how lines with instances of a character before a ‘t’
grep ‘.t’ cars.txt
show lines that have a t, followed by an optional o
grep ‘to*’ cars.txt
show lines that have ford, any characters in the middle, and 83 at the end
grep ‘ford.*83’ cars.txt
highlights either ‘th’ or ‘ch’
grep ‘[tc]h’ cars.txt
show lines starting with the letter ‘t’
grep ‘^t’ cars.txt
show lines ending with ‘5’
grep ‘5$’ cars.txt
how lines with ‘ord’, and exlude results with ‘ford’
grep ‘[^f]’ cars.txt