课程: Ubuntu Linux: Essential Commands

今天就学习课程吧!

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

Change files programmatically

Change files programmatically

- [Instructor] Sed and AWK are common tools for changing the content of files programmatically. They both work at the command line and they each have a programming language of their own to determine how to treat the content of a file. In this video, I want to show you some basics, and if you're interested in a lot more detail, be sure to check out our courses dedicated to each tool. Here though, we'll take a look at using regular expressions to change the content of some files. Sed or stream editor, is a great choice for replacing content in a file or as part of a piped command. At its most basic, a sed statement is a command followed by some parameters. The s command, just the letter s, means a substitute, and then we would give it something to look for and something to substitute that with when it finds it. Let's take a look at that with our users.txt file. First, let's take a look at the contents of the file with cat users.txt, and then, we can pipe that into sed, and between two…

内容