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

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…

Contents