bash - 如何从多个文件中删除多个第一列?
问题描述
我有多个这样的文件:
trans_ENSG00000047849.txt.traw
trans_ENSG00000047848.txt.traw
trans_ENSG00000047847.txt.traw
...
每个都有大约 300 列。列用制表符分隔。我想从每个文件中删除前 7 列。
我知道如何为每个文件执行此操作:
cut -f 7- trans_ENSG00000047849.txt.traw > trans_ENSG00000047849.txt.trawN
有没有办法一次对所有文件执行此操作?
注意:开头有一个标签。因此,我在这里使用 cut -f 7 而不是 cut -f 8 来删除前 7 列。
解决方案
只需使用一个for
循环:
for file in *.txt.traw
do
cut -f 7- "$file" > "$file"N
done
推荐阅读
- asp.net - 发布集合 - 在表格行上添加类时为空/null
- node.js - 在 conda 环境中安装 nodeJS
- r - 如何重命名列中某个值之前出现的 n 行?
- javascript - 对象扩展运算符语法不适用于 JavaScript 中的计算属性
- java - Java - 获取对象的所有本地字段值作为映射
- spring - 如何让我的 Spring Boot 应用程序接受绝对 uri?
- android - Webview 不显示谷歌地图完全控制按钮
- java - 使用嵌套 if else 和 switch 语句重构代码的设计模式
- json - Swift - 将类型动态传递给 JSONDecoder
- sql - PostgreSQL 多行作为列