Basic introduction of sed
1. Overview of course knowledge.
1) Overview of the three Musketeers sed command
2) the basic syntax of the three Musketeers sed command execution principle command
3) three Musketeers sed command practical exercises to add (add information) delete (modify) check (find)
4) scripting: system-based optimization scripts
Script-- put it in the system-- execute the script-- optimize it all (easy)
2. Review of curriculum knowledge
1) basic regular symbols: 7 ^ $. *\ [] [^]
2) extended regular symbols: 5? + {} | ()
Extended regular use:
Grep-E = = egrep
Sed-r
3) summarize the parameter filtering information of grep command
-I-ignore case search information
-n-display the line number after searching for information
-c-count the number of rows filtered
-v-invert the search information
-o-only output and display matching information
-w-match information by string
-A-filter the information after the specified content
-B-filter the information before the specified content
-C-filter the information above and below the specified content
-E-identify extended regular information
-r-Recursive search for specified data content []
3. An overview of the three Musketeers command sed
Sed-stream editor for filtering and transforming text
1) you can find, filter and filter out the specified information
2) be good at editing the content information of files
3) be good at manipulating the lines of a file
4. The execution principle of the three Musketeers' command sed
1) implement the principle process:
2) Command syntax structure:
Sed [parameters] (add as appropriate) 'conditions, instructions (actions processed)' file information (processed files)
Condition definition: processing according to line number content regular information
Instruction definition: information processing actions that meet the conditions (add, delete, modify output)
5. Three Musketeers sed command practice
Prepare the test file:
Cat > > person.txt