Linux Basics Practice Test: VI Editor & sed Editor — Flashcards | Linux | FatSkills

Linux Basics Practice Test: VI Editor & sed Editor — Flashcards

Fast review mode: answers are shown by default so you can skim quickly. Hide them if you want to self-test.

The sed command is a text stream editor in Linux that can perform many functions on files, including searching, finding and replacing, inserting, deleting, and matching regular expressions. The sed command can be used to edit files without opening them. The syntax for the sed command is sed OPTIONS... (SCRIPT) (INPUTFILE...). 
Vi is a text editor that has the inline editor version of sed called sed.

Here are some examples of using sed:
sed 'p' BSD:
Prints each line of the BSD file twice
sed -n 'p' BSD: Suppresses automatic printing
sed -n '1p' BSD: Prints the first line of the file
sed '1~2d' BSD: Deletes every other line starting with the first
sed -i 's/<search regex>/<replacement>/g' <input file>: Tells the sed command to write the results to a file instead of standard output, indicates the substitute command, and is the string or regular expression search parameter
sed 's/box/bin/' foxinbox.txt: Replaces instances of box with the word bin 

Here are some common sed options:
s:
Substitute command
i: Ignore case
d: Delete line 

Related test: Unix Basics Practice Test: Advanced Vi 

1 of 19 Ready
Which one of the following statement is not true?
vi editor commands are not case sensitive
Shortcuts
Prev Space Show / hide Next
Turn this into a study set.
Sign in with Google to save tricky questions to your reminder list and resume on any device.
Sign in with Google Free • no extra password