From the course: Linux Bash Shells and Scripts: Streamlining Tasks and Enhancing Workflows with Automation
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
The use of sed for powerful scripting - Linux Tutorial
From the course: Linux Bash Shells and Scripts: Streamlining Tasks and Enhancing Workflows with Automation
The use of sed for powerful scripting
- [Instructor] A very powerful, very handy, but takes some learning. It has a lot of capabilities. The command is sed. Sed stands for stream editor. What does that mean? Well, it means you can stream stuff into it. It works as a filter. It's not interactive like VI or nano or something like that. It's a great tool for doing a bunch of edits on a bunch of files. You need to process a lot of files and make some changes. Making a script that uses sed might be a really great solution. So sed normally applies it's editing to all the lines in the input so you can change one string to another one, for example, on every line in the input file. And as an ordinary filter, you could like pipe into it and it'll write out its output. But you can use sed on a file so you don't have to pipe into it, sed a file and if you just do that sort of ordinary sed in a file and stuff to do, then it'll write its output on standard out. If you want it to rewrite the file, then you can use the -i option, the sed…
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
-
-
-
-
-
Defining filters and using head, tail, and wc3m 18s
-
(Locked)
The use of sed for powerful scripting5m 55s
-
(Locked)
Using AWK5m 22s
-
(Locked)
Positional parameters and curly braces for variables3m 40s
-
(Locked)
Shell parameter expansion3m 47s
-
(Locked)
Challenge: Looping and special variable operators1m 12s
-
(Locked)
Solution: Looping and special variable operators2m 23s
-
(Locked)
Challenge: sed and AWK1m 33s
-
(Locked)
Solution: sed and AWK3m 17s
-
-
-