1、創建測試數據
[root@centos7 test2]# cat > a.txt i s g z e q d k i p m h y u t e ^C [root@centos7 test2]# ls a.txt [root@centos7 test2]# cat a.txt i s g z e q d k i p m h y u t e
2、提取列數為3的行
[root@centos7 test2]# cat a.txt i s g z e q d k i p m h y u t e [root@centos7 test2]# awk 'NF == 3' a.txt z e q m h y
3、刪除列數為3的行
[root@centos7 test2]# cat a.txt i s g z e q d k i p m h y u t e [root@centos7 test2]# awk 'NF != 3' a.txt i s g d k i p u t e
