I am reading a tool manual and it instructs to use such a command:
Code:
cat word-list | sort +1 -rn | \ awk '{ print $1}' > result.txt
Especially, what does the 'sort' parameters and awk do?
Thanks for explanation.
As you can see in the picture attached
screen shot
After i used the sort command to sort a VERY large wordlist file i then split them up using the Split command. From there i confirmed that the listed words are in a-z order.
I then ran the sort -u command and noticed that it was not removing unique words.
My job involves a lot of sorting fields from very large files. I usually do this with the sort command in bash. Unfortunately, when I start a sort I am never really sure how long it is going to take.
I'm trying to sort the following file:
a 2
b 1
a 10
I need to get:
a 2
a 10
b 1
I know about the -kPOS[opts] option, and try to use it:
sort -k1 -k2n file
but this command gives me only:
a 10
a 2
b 1
So it sorts by the first column, but no by the second.
1. The problem statement, all variables and given/known data:
Show all users who are currently logged in, sorted from earliest to latest log in time. The log in time includes the month, day, and time.
2. Relevant commands, code, scripts, algorithms:
finger, who, sort, pipe, head, tail,
3.
I have need of a sorting script that will sort a file of tab delimited data on multiple columns. I often do this kind of thing in excel, but I have need of something more automated. I guess the syntax would be something like, sort by columnName, then by otherColumnName, etc.
Hey Guys,
I am facing an annoying scenario, fewer times when I execute the sort command, it throws out on error saying that "No Space on available on /var/tmp/<temp file name>. May be it is set to /var/tmp directory. I was wondering, if I cant redirect the temporary file creation to any other directory. I came across this "-T" option, but was not sure about it.
Usually, "sort" will sort 10, 11, 12 ahead of 2, 3, 4.
To sort by number, you can simply do "sort -n."
I have a slightly more complicated problem.
I have files that begins with chr1, chr2, chr3, ..., chr10, chr11.
How do I sort it, so that chr2, chr3, ... will be sorted ahead of chr10, chr11?
Thanks in advance.
I would like to get the last tag of a git repository.
For a while I used:
git tag | sort -rn | head -1
But today I have this list of tags
0.1
0.10
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
So the previous command says the last tag is 0.9 and not 0.10
My first solution was to do that:
git tag | sed -e 's/\./0/g' | sort -rn | head -1
Then I get the right list:
0010
009
008
007
006
005
004
003
002