study/linux/awk/README.md

11 lines
186 B
Markdown
Raw Permalink Normal View History

2020-02-23 14:23:40 +00:00
* 获取比较两个文件的相同行
```sh
awk 'NR==FNR{a[$1]++} NR!=FNR{if($1 in a){print}}' text1.txt text2.txt
```
* 打印行数大于n的内容
```sh
awk 'NR >= n' filename
```