我想打印一条有图案的线和它之前的线。
例如:说文件是:  
This is line 1  
This is line 2  
This is FORMAT line 3  
This is line 4  
This is line 5  
This is FORMAT line 6
说我要搜索的模式是FORMAT。所以输出应该是  
This is line 2  
This FORMAT line 3  
This is line 5
This is FORMAT line 6.
我尝试使用sed,我能够打印带有图案的行,但不能打印上一行。  
第二个问题(不想创建一个单独的问题)如何打印下一行中没有特定模式的行?例如。对于上述文件和模式,输出应该是
This is line 1    
This is line 4