欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

用sed命令模拟tac

程序员文章站 2022-03-04 17:53:36
...
原始数据
cat data

This is the header line.
This is the first data line.
This is the second data line.
This is the last line.

tac data

This is the last line.
This is the second data line.
This is the first data line.
This is the header line.

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.
相关标签: sed