Modify and Replace Flashcards

Obj 1.5 (14 cards)

1
Q

What do modify and replace commands like sed and tr allow users to do?

A

Efficiently modify and replace text directly from the command line.

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

Why are these commands essential?

A

They automate updates in configurations, correct errors, and standardize data across multiple files.

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

What does sed stand for?

A

Stream editor.

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

What does sed do?

A

Modifies and replaces text within files or data streams without opening them in a text editor

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

How does sed process text?

A

Line by line, allowing actions like substitution, insertion, or deletion.

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

What is the basic syntax of a sed command?

A

sed [modifier] ‘command’ file

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

Example — what does sed ‘s/old_hostname/new_hostname/g’ config_file.txt do?

A

Replaces all instances of “old_hostname” with “new_hostname” in config_file.txt.

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

For sed, what does the d modifier do?

A

Deletes lines matching a given pattern.

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

For sed, what does the n modifier do?

A

Skips automatic printing and moves directly to the next line.

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

For sed, what does the p modifier do?

A

Prints matching lines, often used with -n to control output.

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

For sed, what does the s modifier do?

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

Can sed use regular expressions?

A

Yes, it supports regex for automating complex text edits.

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