用sed命令模拟tac


用sed命令模拟tac
 
原始数据   www.2cto.com  
Shell代码  
cat data  
 
This is the header line. 
This is the first data line. 
This is the second data line. 
This is the last line. 
 
Shell代码  
tac data  
 
This is the last line. 
This is the second data line. 
This is the first data line. 
This is the header line. 
 
Shell代码    www.2cto.com  
sed -n  '{1!G;h;$p}' data  
 
This is the last line. 
This is the second data line. 
This is the first data line. 
This is the header line.
 

相关内容

    暂无相关文章