Linux   发布时间:2022-03-31  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Awk:从许多不同的文件中提取不同的列大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

文件示例 I have a 3-10 amount of files with: - different number of columns - same number of rows - inconsistent spacing (sometimes one space, other tabs, sometimes many spaces) **within** the very fil
文件示例

I have a 3-10 amount of files with:

 - different number of columns
 - same number of rows
 - inconsistent spacing (sometimes one space,other tabs,sometimes many spaces) **within** the very files like the below


>      0    55.4      9.556E+09   33
>      1     1.3      5.345E+03    1
>        ........
>     33   134.4      5.345E+04  932
>
       ........

我需要从file1获取列(例如)1,从file2获取第3列,从file3获取第7列,从file4获取第1列,并将它们并排放入单个文件中.

试验1:不工作

试用版2:使用2个文件但不使用多个文件

现在更一般的问题:

解决方法@H_801_36@ @H_618_37@ 在粘贴/剪切尝试中,用awk替换剪切:

$paste <(awk '{print $1}' file1 ) <(awk '{print $3}' file2 ) <(awk '{print $7}' file3) <(awk '{print $1}' file4)

大佬总结

以上是大佬教程为你收集整理的Awk:从许多不同的文件中提取不同的列全部内容,希望文章能够帮你解决Awk:从许多不同的文件中提取不同的列所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。