0

INPUT (tab delimited)

HTR12   AT1G01370       Chr1    143564  145684  +
SDG42   AT1G01920       Chr1    316128  319650  +
SDG5    AT1G02580       Chr1    544783  549202  +

OUTPUT (tab delimited)

Chr1    143564  145684  HTR12   AT1G01370       +
Chr1    316128  319650  SDG42   AT1G01920       +
Chr1    544783  549202  SDG5    AT1G02580       +

my solution is

awk -v OFS="\t" '{print $3,$4,$5,$2,$1,$6}' input > output

But seems not good.

  • Any chance of seeing what seems not good really is? BTW, I think you mean awk -v OFS="\t" '{print $3,$4,$5,$1,$2,$6}' input > output – Tigger Nov 6 '16 at 8:46
1

try

awk -F'\t '{print $3,$4,$5,$1,$2,$6}' input > output

this will set FS (field separator) for both IFS (input) and OFS (output).

I also swap $1 and $2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.