ChinaUnix.net
相关文章推荐:

sort out

sort是如何比较的,忽略空格吗 test.TXT 如下 d b a e d sort test.TXT 输出 a b d d e 不是应该为: d a b d e 空格被忽略了吗

by ahjxhly - Shell - 2012-10-13 12:05:26 阅读(1135) 回复(4)

相关讨论

本帖最后由 shihyu 于 2011-07-12 19:10 编辑 sss

by shihyu - C/C++ - 2011-01-06 09:08:55 阅读(2754) 回复(11)

[root@localhost test]# sort -t: +1 video.txt sort: open failed: +1: No such file or directory 我的系统是Fedora 10,是不是sort不再支持+n选项了? 备注sort的帮助: [root@localhost test]# sort --help Usage: sort [OPTION]... [FILE]... Write sorted concatenation of all FILE(s) to standard output. Mandatory arguments to long options are mandatory for short options too. Ordering options: -b, --ignore-...

by yanjin415 - Shell - 2009-03-04 09:54:41 阅读(3606) 回复(16)

sort -t: -k3 -n /etc/passwd 说明:该命令作用是根据passwd的第3列,uid进行排序 参数: -t表示分割符,以:分割,默认情况下以空格分割 -k作用是根据某个列来排序,这里根据第3列,默认是第1列(从1开始)。 -n按照数字方式排序。不加-n参数时排序结果根据最左面的数字开始,等同于字母的比较方式。 补充,当需要比较多列时候,可再加上-k sort -t: -k3 -k4 -n /etc/passwd 本文来自ChinaUnix博客,如果查看原文请点:...

by peacock66 - Linux文档专区 - 2008-10-30 10:25:06 阅读(731) 回复(0)

按列排序 [oracle@oraserver udump]$ ls -l | sort -k 6 总用量 480 -rw-r----- 1 oracle oinstall 1610 1月 11 08:51 ora9i_ora_4571.trc -rw-r----- 1 oracle oinstall 1603 1月 11 08:59 ora9i_ora_3986.trc -rw-r----- 1 oracle oinstall 1644 1月 24 08:46 ora9i_ora_7591.trc -rw-r----- 1 oracle oinstall 1644 2月 3 17:19 ora9i_ora_4207.trc -rw-r----- 1 oracle oinstal...

by peitomb - Linux文档专区 - 2008-04-25 21:27:11 阅读(599) 回复(0)

有这么一个数组: @list = ("Alb","ant","zor","Zai"); 对它sort时,大写字母开头的都排在前面。 而我想要的是不管大小写,按正常alpha字母顺序进行sort。 于是用了一个施瓦茨转换: @sort = map { $_->[1] } sort {$a->[0] cmp $b->[0]} map { [lc($_),$_] } @list; 这个works. 然后想到ruby的Schwart Transform应该更简单,一试之下果然是: > list.map{|c| [c.downcase,c]}.sort.map{|d| d[1]} => ["Alb", "ant", "Zai"...

by 兰花仙子 - Perl - 2010-11-03 13:36:37 阅读(2885) 回复(18)

我将文件pciebus处理成3列文件,我想第一列和第二列都重复的行,如图删除图中红色选中的行。 我看说sort -u 是删除重复的,-k 选定特定的域 可是得到的都不是我想要的

by 刘彩霞 - Shell - 2013-12-24 16:31:51 阅读(1459) 回复(9)

使用sort()时报错,脚本如下 [root@localhost py]# cat a.py #!/usr/bin/python from sys import argv script, filename = argv tmpfile = open(filename) file = tmpfile.read() print file.sort() [root@localhost py]# [root@localhost py]# [root@localhost py]# ./a.py a.txt //报错信息如下 Traceback (most recent call last): File "./a.py", line 8, in ? print file.sort() AttributeError: 'st...

by luwenju - Python - 2012-11-23 17:01:36 阅读(1121) 回复(2)

sort的默认分隔符是哪个那,还是sort能自动识别分隔符那

by mengchang_cu - Shell - 2012-02-05 05:08:18 阅读(927) 回复(2)

各位大侠: sort时出现了[sort:missing NEWLINE added at end of input file ] 这个提示信息。到底是怎么回事呀? 那位大侠能帮我解释解释。 祝:中秋节快乐。

by sunguangshou - Shell - 2010-09-26 13:17:50 阅读(2856) 回复(16)

最近在工作中碰到一些sort的问题, 突然发现如果对一些选项的细节不清楚, 很容易造成错误的排序, 灰常有必要总结一下: 一. 基本用法, 差不多是man sort的翻译: sort将文件的每一行作为一个单位,相互比较,比较原则是从首字符向后,依次按ASCII码值进行比较,最后将他们按升序输出。 1. -u 在输出行中去除重复行 2. -r 默认的排序方式是升序, 如果想改成降序, 用这个选项 3. -n 有没有碰到过100比99要...

by binary_XY.Z - Linux文档专区 - 2009-12-22 15:27:44 阅读(809) 回复(0)