我需要删除要用awk删除的输出的第一行。以下是命令和输出已显示..
bash-3.2$ ldaplist -l hosts mylv104 | awk -F: '/cdsLocationDetail|.seemac.com|ipHostNumber/ {print $2}'
cn=mylv104+ipHostNumber=196.2.16.181,ou=hosts,ou=corp,ou=services,o=seemac.com
R3/C12/U21
mylv104.seemac.com
196.2.16.181
虽然我用另一个带管道的awk但是我不想要它...
bash-3.2$ ldaplist -l hosts mylv104 | awk -F: '/cdsLocationDetail|.seemac.com|ipHostNumber/ {print $2}' |awk 'NR>1'
R3/C12/U21
mylv104.seemac.com
196.2.16.181
答案 0 :(得分:1)
您可以在匹配线时设置标记,如下所示:
ldaplist -l hosts mylv104 | awk -F: '/cdsLocationDetail|.seemac.com|ipHostNumber/{if(!firstMatch){firstMatch=1;next;}print $2}'