Regular Expressions: sed

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/23

flashcard set

Earn XP

Description and Tags

Practice flashcards covering the definitions, options, syntax, and specific commands of the sed stream editor based on lecture notes.

Last updated 5:17 PM on 6/1/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

24 Terms

1
New cards

sed (Stream Editor)

A non-interactive, line-oriented stream editor that processes one line at a time and is used for text processing and in-place substitution.

2
New cards

-r option

An option that makes regular expressions work better by correctly recognizing characters like ( ), [ ], *, and +.

3
New cards

s command

The substitution command used to replace occurrences of a matched regex pattern with specific text, following the syntax [address(es)]s/pattern/replacement/[flags].

4
New cards

g flag

A global match flag placed after the last delimiter in a substitution command to replace all occurrences of a pattern in the pattern space.

5
New cards

-i option

An option used to make permanent changes to a file by performing editing in-place.

6
New cards

-n option

An option that suppresses automatic output, ensuring that only lines specified with a print command or 'p' flag are displayed.

7
New cards

-f script

An option indicating that the next argument is a filename containing editing commands.

8
New cards

-e command

An option used when the next argument is an editing command rather than a filename, useful for specifying multiple commands.

9
New cards

Pattern Space

A temporary buffer where sed copies each line of input to apply editing commands.

10
New cards

Address

A component of a sed command, consisting of a line number or regular expression, that determines which lines in the input file are processed.

11
New cards

! operator

A complement operator used to negate an address, applying the associated command only to lines that do NOT match the address.

12
New cards

d command

A deletion command that removes addressed lines from the pattern space and prevents them from being passed to standard output.

13
New cards

{ } braces

Used to group and apply multiple commands to a specific address or address range.

14
New cards

p command

A command used to force the output of the pattern space, typically used when the -n option is specified.

15
New cards

& (ampersand)

A special character used in the replacement string of a substitute command that represents the entire string matched by the regular expression.

16
New cards

\n (backreference)

A replacement pattern character replaced by the nth substring or sub-expression previously specified using '(' and ')'.

17
New cards

a command

The append command used to add text after the addressed line; it must be specified on multiple lines as [address]a\ text.

18
New cards

i command

The insert command used to add text before the addressed line, following the syntax [address]i\ text.

19
New cards

c command

The change command used to replace addressed lines with new text, using the syntax [address(es)]c\ text.

20
New cards

r command

The read command used to queue the contents of a filename to be inserted into the output stream at the end of the current cycle.

21
New cards

w command

The write command used to write the current pattern space to a specified filename, which is created or truncated before reading.

22
New cards

= command

The line number command which writes the current line number before each matched or output line.

23
New cards

y command

The transform command which performs a one-to-one character-to-character replacement, similar to the tr command.

24
New cards

q command

The quit command which terminates the sed script once the specified address is encountered.