小编ssn*_*ssn的帖子

如何从末尾计数的文本行中剪切(选择)一个字段?

我知道如何使用 cut 命令从一行中选择一个字段。例如,给定以下数据:

a,b,c,d,e
f,g,h,i,j
k,l,m,n,o
Run Code Online (Sandbox Code Playgroud)

这个命令:

cut -d, -f2 # returns the second field of the input line
Run Code Online (Sandbox Code Playgroud)

返回:

b
g
l
Run Code Online (Sandbox Code Playgroud)

我的问题:如何选择从末尾开始计数的第二个字段?在前面的示例中,结果将是:

d
i
n
Run Code Online (Sandbox Code Playgroud)

shell text-processing cut

47
推荐指数
2
解决办法
9万
查看次数

标签 统计

cut ×1

shell ×1

text-processing ×1