- 论坛徽章:
- 60
|
回复 35# 聆雨淋夜
跟 awk 的版本有关系, awk 4.0+ 的版本不会有这个问题. awk 3.x 版本中或许没有引入 STRNUM 类型.
[root@localhost ~]# echo -e '20.7\n25.5\n3'| /bin/awk '{a[$0]}END{for(i in a){if(i>20)print i}}'
20.7
25.5
3
[root@localhost ~]# /bin/awk --version
GNU Awk 3.1.5
Copyright (C) 1989, 1991-2005 Free Software Foundation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
[root@localhost ~]#
[root@localhost ~]# echo -e '20.7\n25.5\n3'| awk '{a[$0]}END{for(i in a){if(i>20)print i}}'
25.5
20.7
[root@localhost ~]# awk --version
GNU Awk 4.1.1, API: 1.1
Copyright (C) 1989, 1991-2014 Free Software Foundation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/.
[root@localhost ~]#
|
|