什么是`sort -t''-rn +2 -3` 在这个管道中做什么? [英] What does `sort -t' ' -rn +2 -3` do in this pipeline?
本文介绍了什么是`sort -t''-rn +2 -3` 在这个管道中做什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下由某人编写的代码片段,但我不明白 sort -t' ' -rn +2 -3
的作用.
I have below code snippet written by someone but I don't understand what sort -t' ' -rn +2 -3
does.
ps aux|tr -s ' '|cut -f1-3,11 -d' '|grep $USER|sort -t' ' -rn +2 -3|cut -f2 -d' '|head -5
特别是 +2
和 -3
选项.我知道 -r
用于反向而 -n
用于数字.
Especially +2
and -3
options. I know -r
is for reverse and -n
is for numbers.
推荐答案
该命令做了很多不必要的工作.您可以使用 pgrep
将其替换为以下命令:
The command does a lot of unnecessary work. You can replace it by the following command using pgrep
:
pgrep -U"$USER" | sort -r | head -5
顺便说一句,为了简单地理解 sort -t' ' -rn +2 -3
的含义,您应该按照您的问题下方的 @1_CR
评论进行操作.
Btw, in order to simply understand what sort -t' ' -rn +2 -3
means, you should follow the comment from @1_CR
below your question.
这篇关于什么是`sort -t''-rn +2 -3` 在这个管道中做什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文