Forcing the order of output fields from cut command

This can’t be done using cut. According to the man page:

Selected input is written in the same order that it is read, and is
written exactly once.

Patching cut has been proposed many times, but even complete patches have been rejected.

Instead, you can do it using awk, like this:

awk '{print($2,"\t",$1)}' abcd.txt

Replace the \t with whatever you’re using as field separator.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)