Awk:从许多不同的文件中提取不同的列
发布时间:2020-12-13 23:18:33 所属栏目:Linux 来源:网络整理
导读:文件示例 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
文件示例
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个文件但不使用多个文件
现在更一般的问题:
解决方法
在粘贴/剪切尝试中,用awk替换剪切:
$paste <(awk '{print $1}' file1 ) <(awk '{print $3}' file2 ) <(awk '{print $7}' file3) <(awk '{print $1}' file4) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |