用awk打印从第n个所有列到最后 [英] Using awk to print all columns from the nth to the last

查看:2493
本文介绍了用awk打印从第n个所有列到最后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我有这条线,它的工作,直到我在第二个字段有空格。

right now I have this line, and it worked until I had whitespace in the second field.

svn status | grep '\!' | gawk '{print $2;}' > removedProjs

有没有办法让awk的打印$ 2或更大的一切吗? ($ 3,$ 4个..直到我们没有再列?)

is there a way to have awk print everything in $2 or greater? ($3, $4.. until we don't have anymore columns?)

我想我应该补充一点,我在Windows环境中使用cygwin的这样做。

I suppose I should add that I'm doing this in a windows environment with cygwin.

推荐答案

将打印所有,但第一个栏:

will print all but very first column:

awk '{$1=""; print $0}' somefile

将打印所有,但两个第一列:

will print all but two first columns:

awk '{$1=$2=""; print $0}' somefile

这篇关于用awk打印从第n个所有列到最后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆