I'm on Windows 7. I have a large text file code.txt
with the following equalities
oReservist.Role = Sheets("RECAP").Cells(ligne, 2)
oReservist.Surname = Sheets("RECAP").Cells(ligne, 3)
oReservist.Name = Sheets("RECAP").Cells(ligne, 4)
...
I want to change the first part of the equality by the second and the second by the first one. That is to say :
Sheets("RECAP").Cells(ligne, 2) = oReservist.Role
Sheets("RECAP").Cells(ligne, 3) = oReservist.Surname
Sheets("RECAP").Cells(ligne, 4) = oReservist.Name
...
How can I handle that ?
Until now that if I were on Linux I could have used awk
with " = " as field separator, and simply turn around the fields.
awk -F " = " '{OFS=FS;print $2,$1}' file
or using sed:
sed 's/\(.*\) = \(.*\)/\2 = \1/' file
But it seems they are not recognised on Windows as I have the folowing error:
PS C:\Users\alliasjb\Desktop> sed
Le terme « sed » n'est pas reconnu comme nom d'applet de commande, fonction, fichier de script ou programme exécutable.
Vérifiez l'orthographe du nom, ou si un chemin d'accès existe, vérifiez que le chemin d'accès est correct et réessayez
awk
,sed
orperl -pe 's/(.*) = (.*)/$2 = $1/' file
.