与Unix工具和多列排序 [英] Sorting with unix tools and multiple columns
本文介绍了与Unix工具和多列排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要寻找解决这一问题的最简单方法。我有一个巨大的数据集,我不能加载到Excel的这种类型的格式
的 这是一个句子| 10
这是另一个句子| 5
这是最后一句| 20
我想要做的那种,这是从低到高的基础上的数量。
猫MyDataSet.txt | TR| \\ t的| ???
不知道最好的办法就是要做到这一点,我想使用awk来切换列和做一个排序的话,但我遇到了麻烦这样做。
帮我出请
解决方案
排序-t \\ | -k + 2N dataset.txt
应该这样做。字段分隔和备用键选择
I am looking for the easiest way to solve this problem. I have a huge data set that i cannot load into excel of this type of format
This is a sentence|10
This is another sentence|5
This is the last sentence|20
What I want to do is sort this from least to greatest based on the number.
cat MyDataSet.txt | tr "|" "\t" | ???
Not sure what the best way is to do this, I was thinking about using awk to switch the columns and the do a sort, but I was having trouble doing it.
Help me out please
解决方案
sort -t\| -k +2n dataset.txt
Should do it. field separator and alternate key selection
这篇关于与Unix工具和多列排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文