我有以下矩阵,其中包含这样的列:
TRINITY_DN12001_c0_g1_i3^ARC3_ARATH^MORN 1.52 1.20 1.25
TRINITY_DN109651_c0_g1_i1 12.38 32.55 62.98 37.92 9.05
TRINITY_DN26469_c0_g1_i1 1.91 0.00 2.62 2.92 2.22
我想为每一行提取第一列 (TRINITY_DN12001_c0_g1_i3) 的一部分,并使用该 ID 创建一个新列。我希望新的矩阵本质上是相同的,只是带有从之前提取的 ID。我想我必须使用 awk,但不确定如何处理这些数字。我希望它看起来像这样:
TRINITY_DN12001_c0_g1_i3 TRINITY_DN12001_c0_g1_i3^ARC3_ARATH^MORN 1.52 1.20 1.25
TRINITY_DN109651_c0_g1_i1 TRINITY_DN109651_c0_g1_i1 12.38 32.55 62.98 37.92 9.05
TRINITY_DN26469_c0_g1_i1 TRINITY_DN26469_c0_g1_i1 1.91 0.00 2.62 2.92 2.22
任何帮助,将不胜感激。
答案1
告诉我这是否适合你:
sed 's/\([^\^ ]*\)/\1 \1/' file | tr -s ' '
输出:
TRINITY_DN12001_c0_g1_i3 TRINITY_DN12001_c0_g1_i3^ARC3_ARATH^MORN 1.52 1.20 1.25
TRINITY_DN109651_c0_g1_i1 TRINITY_DN109651_c0_g1_i1 12.38 32.55 62.98 37.92 9.05
TRINITY_DN26469_c0_g1_i1 TRINITY_DN26469_c0_g1_i1 1.91 0.00 2.62 2.92 2.22
这与预期输出相匹配:
TRINITY_DN12001_c0_g1_i3 TRINITY_DN12001_c0_g1_i3^ARC3_ARATH^MORN 1.52 1.20 1.25
TRINITY_DN109651_c0_g1_i1 TRINITY_DN109651_c0_g1_i1 12.38 32.55 62.98 37.92 9.05
TRINITY_DN26469_c0_g1_i1 TRINITY_DN26469_c0_g1_i1 1.91 0.00 2.62 2.92 2.22