Grep Flashcards

1
Q

show lines with keyword “accord”

A

grep ‘accord’ cars.txt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

ignore case sensitivity and show keyword “accord”

A

grep -i ‘accord’ cars.txt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

ignore cases and show line numbers and show keyword “accord”

A

grep -in ‘accord’ cars.txt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

show lines WITHOUT keyword “accord”

A

grep -v ‘accord’ cars.txt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

count how many lines contain keyword “chevy”

A

grep -c ‘chevy’ cars.txt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

show lines with numbers 5-7

A

grep ‘[5-7] cars.txt’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

how lines with instances of a character before a ‘t’

A

grep ‘.t’ cars.txt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

show lines that have a t, followed by an optional o

A

grep ‘to*’ cars.txt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

show lines that have ford, any characters in the middle, and 83 at the end

A

grep ‘ford.*83’ cars.txt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

highlights either ‘th’ or ‘ch’

A

grep ‘[tc]h’ cars.txt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

show lines starting with the letter ‘t’

A

grep ‘^t’ cars.txt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

show lines ending with ‘5’

A

grep ‘5$’ cars.txt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

how lines with ‘ord’, and exlude results with ‘ford’

A

grep ‘[^f]’ cars.txt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly