On peut aussi permuter 2 colonnes sous vi, donc interactivement.
Dans ton exemple où le séparateur de colonne est "
:"
:%s/\(.*\):\(.*\):\(.*\):\(.*\)/\1:\3:\2:\4/
signifie
: après
[esc] indique une action sur le texte
% l'action porte sur l'ensemble du texte
s l'action est une substitution
/ début de description de la ligne
\(.*\) un groupe contenant plusieurs caractères quelconque
: sauf : qui sert de séparateur
/ fin de la ligne et commencement de la description
de la réécriture
\1 recopie le premier groupe
: écrit le nouveau séparateur, ici c'est le même
etc
Hope, it's help you
---------------------------------------------------------
(°> Dhénin Jean-Jacques
/ ) 48, rue de la Justice 78300 Poissy
^^
Jean-Jacques@dhenin.fr