使用awk打印从第n到最后的所有列 [英] Using awk to print all columns from the nth to the last
本文介绍了使用awk打印从第n到最后的所有列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这条线一直有效,直到我在第二个字段中有空格.
This line 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?)
我想我应该补充一点,我是在使用 Cygwin 的 Windows 环境中执行此操作的.
I suppose I should add that I'm doing this in a Windows environment with Cygwin.
推荐答案
打印所有列:
awk '{print $0}' somefile
打印除第一列之外的所有内容:
Print all but the first column:
awk '{$1=""; print $0}' somefile
打印除前两列之外的所有内容:
Print all but the first two columns:
awk '{$1=$2=""; print $0}' somefile
这篇关于使用awk打印从第n到最后的所有列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文