From the course: LPIC-1 Exam 101 (Version 5.0) Cert Prep
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Use regular expressions to delete, change, and substitute text - Linux Tutorial
From the course: LPIC-1 Exam 101 (Version 5.0) Cert Prep
Use regular expressions to delete, change, and substitute text
- [Instructor] For this video, we're going delete, change and substitute texts using the sed stream editor and regular expressions. In the chapter nine directory of the Exercise Files, I've included a system pattern file named "PASSWD". We'll use this file with sed. Be sure you're in the chapter nine directory and then type in "LS" to verify. Now let's use sed to print lines of this file that matches a pattern. This will be the same as using grep. Type in "clear", then type in "sed -n '/root/p' passwd". The pattern that we're matching is the word "root", which is between the forward slashes and then printing the result, which is two lines. The narrow it down to one line we can use an anchor. Type in "clear" and then type in "sed -n '/[caret]", which is the anchor to the beginning of the line, "root/p' passwd" and hit enter. This anchors to the beginning of the line and shows one line; the line that starts with "root".…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
-
-
(Locked)
Understand the differences between basic and extended regular expressions3m 38s
-
(Locked)
Matching characters and words with regexes3m 5s
-
(Locked)
Specifying occurrences with regexes1m 56s
-
(Locked)
Alternation and grouping with regexes3m 21s
-
(Locked)
Back references and subexpressions1m 48s
-
(Locked)
Search text using regular expressions5m 31s
-
(Locked)
Use regular expressions to delete, change, and substitute text5m 16s
-
(Locked)
Awareness of Emacs, Nano, and Vim2m 49s
-
(Locked)
An introduction to Vim3m 33s
-
(Locked)
Edit text in Vim2m 45s
-
(Locked)
Search and replace in Vim2m 26s
-
(Locked)
-
-
-
-