为什么没有将sort -c
输出重定向到文件temp.txt
?
如果删除-c
,它将重定向,如下所示:
$ cat numericSort
33:Thirty Three:6
11:Eleven:2
45:Forty Five:9
01:Zero One:1
99:Ninety Nine:9
18:Eighteen:01
56:Fifty Six:4
78:Seventy Eight:2
$ sort numericSort > temp.txt
$ cat temp.txt
01:Zero One:1
11:Eleven:2
18:Eighteen:01
33:Thirty Three:6
45:Forty Five:9
56:Fifty Six:4
78:Seventy Eight:2
99:Ninety Nine:9
$ rm temp.txt
$ sort -c numericSort > temp.txt
sort: numericSort:2: disorder: 11:Eleven:2
$ cat temp.txt
# No Output Here
最佳答案
sort -c
的输出转到stderr
,而不是stdout
。
如果要改为重定向:
$ sort -c numericSort 2> temp.txt
关于linux - 将sort -c输出重定向到文件:Linux命令,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23419914/