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... Show more 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 Show less
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
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.