包含需要打印的列数的数组如下:
${UNIQUE[@]} = 1 2 3 5 6 7 8 9 10 11 12 13 14 15 16 17 18 20 21 26 30 35 37 39 40 41
因此,在41列中,我只想打印上面列出的列,它们可能因文件而异.
谢谢!!
解决方法 你可以用cut.请考虑以下示例:UNIQUE=(1 2 4 6) # Array containing columns to be printedfIElds=$( IFS=,echo "${UNIQUE[@]}") # Get the fIElds in comma-delimited form# seq -s,10 would print the string: 1,2,3,4,5,6,7,8,9,10seq -s,10 | cut -d,-f"${fIElds[@]}" # Print the desired fIElds
这会导致
1,6总结
以上是内存溢出为你收集整理的arrays – 将数组传递给awk,其中包含需要打印的列号全部内容,希望文章能够帮你解决arrays – 将数组传递给awk,其中包含需要打印的列号所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)