代码: 全选
Sun 21%cat tmp.txt
* Whetting Your Appetite
* Using the Python Interpreter
* Invoking the Interpreter
* Argument Passing
* Interactive Mode
* The Interpreter and Its Environment
* Error Handling
* Executable Python Scripts
* Source Code Encoding
* The Interactive Startup File
* An Informal Introduction to Python
* Using Python as a Calculator
* Numbers
* Strings
* Unicode Strings
* Lists
* First Steps Towards Programming
例如
代码: 全选
cat 1.txt
* Whetting Your Appetite
代码: 全选
cat 2.txt
* Using the Python Interpreter
* Invoking the Interpreter
* Argument Passing
* Interactive Mode
* The Interpreter and Its Environment
* Error Handling
* Executable Python Scripts
* Source Code Encoding
* The Interactive Startup File
代码: 全选
cat 3.txt
* An Informal Introduction to Python
* Using Python as a Calculator
* Numbers
* Strings
* Unicode Strings
* Lists
* First Steps Towards Programming
sed '/*/,/*/!d' tmp.txt 是最大匹配的,不行
那要如何实现。
我的一个超级麻烦的方法 是先tmp.txt编序号,sed '=',再把主标题的序号提取出来,i=2,j=11,再用sed -n "$i,$jp" .
有没好的方法??