课程: Linux: Bash Shell and Scripts

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Using sed and AWK for more powerful scripting

Using sed and AWK for more powerful scripting - Linux教程

课程: Linux: Bash Shell and Scripts

Using sed and AWK for more powerful scripting

- [Narrator] sed let's you do editing sort of commands, stuff you could do in an editor like vi, but as a filter so it's called a stream editor because you think of the input streaming through it and then it's producing output. So sed is great as a filter and it works great in scripts so you can essentially do a bunch of edits. You can have a batch of editings you do in a script, say process lots of files. Normally, sed applies it's editing commands to every line in a file if it matches something. So it processes a whole file and it doesn't change the file, it's just a file is passed into it, or maybe the output of a command is passed into it and it does it's processing, it produces the output. If you wanna use sed to actually edit a file you can do that too. You can use a sed -I option, then it applies the sed commands you've given it to the file in place. One of the most powerful things you could do with sed is use it's substitute command. The way the substitute command works is you…

内容