首页 > 技术文章 > awk打印出当前行的上一行

Berryxiong 2016-12-21 22:28 原文

#awk '/B/{print a;}{a=$0}' a.txt

A

# cat a.txt
A
B
C
D
E

推荐阅读