【发布时间】:2013-08-24 16:57:24
【问题描述】:
现在我生成一个文本文件,将值存储为 \t 值1 值2 值3。
我想将此文本文件排序为 value1
sort a.txt -o a.txt1
发现它发生了错误
google 1 1
google 1 2
google 1 3
=google 1 4
google 1 3
found =google 被插入到 google 之间。为什么会发生,好奇怪。
我尝试了sort a.txt -t $'\t' -k 1 -o a.txt1,但它有同样的问题。
【问题讨论】:
-
不清楚你的输入是什么,$'\t'有什么用
-
@Himanshu:
$'\t'是在 Bash 中指定选项卡的一种方法。参见例如wiki.bash-hackers.org/syntax/quoting#ansi_c_like_strings -
谢谢@tripleee,我以为我知道很多 bash :)
标签: shell