Search text using regular expressions Flashcards

1
Q

What are the two forms of regular expression?

A

Basic and extended

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

Describe a bracket expression?

A

Any character in the square brackets is matched on

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

Describe a range expression?

A

Any character in the range of characters is the square brackets is matched on

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

What regex character represent any single character?

A

.

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

What regex character represents the start of a line?

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

What regex character represents the end of a line?

A

$

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

How are multiple possible strings defined?

A

|

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

What are used to separate subexpressions?

A

( )

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

What is the escape character?

A

\

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

What command will search files for a specified string?

A

grep

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

What command is the equivalent of grep -E (extended) ?

A

egrep

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

What command is the equivalent of grep -F (fixed strings) ?

A

fgrep

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

What type of grep would be best suited to search for user mark.reed?

A

fgrep - fixed

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

What type of grep would be best suited to search for a mix of possible matches?

A

egrep - extended

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

In which grep mode do the meta-characters ?, +, {, |, (, and ) lose their special meaning?

A

regular

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

Regex which character - the preceding item is optional and matched at most once?

A

?

17
Q

Regex which character - the preceding item will be matched zero or more times?

A

*

18
Q

Regex which character - the preceding item will be matched one or more times?

A

+

19
Q

What should be used for filtering and transforming text?

A

sed

20
Q

What sed switch will make a change to a file without outputing the result to stdout?

A

-i –in-place

21
Q

What letter in sed will replace the first occurance on a line?

A

s (substitute)

22
Q

What letter when used after the expression will change every occurance of a string?

A

g (global)

23
Q

What letter when used after the expression will write the output to a file?

A

w (write)