【发布时间】:2020-05-19 00:42:36
【问题描述】:
我有一个制表符分隔的文本文件,像这个小例子:
小例子:
#type cNA NA me ion Dir Mism Bulge
X GAAGC GAAGa chr8 3997355 - 5 0
X GAAGC GAAGC chr8 11720692 + 5 0
X GAAGC GAAGC chr8 23414961 - 5 0
并希望创建一个类似预期输出的新文件,其中删除第一行并按此顺序重新组织列:
1) columns 1 and 8 are removed.
2) 2nd column (small example file) moved to 1st column (expected output).
3) 4th column moved to the 2nd column.
4) 5th column moved to 3rd column.
5) 3rd column moved to 4th column.
6) 6th column moved to 5th column.
7) 7th column moved to 6th column.
这是预期的输出:
预期输出:
GAAGC chr8 3997355 GAAGa - 5
GAAGC chr8 11720692 GAAGC + 5
GAAGC chr8 23414961 GAAGC - 5
我正在尝试使用以下命令在AWK 中执行此操作:
awk -F '\t' '{ print $2 $4 $5 $3 $6 $7}' infile.txt > output.txt
但我得到的结果与预期的输出不同。你知道如何修复代码吗?
【问题讨论】: