Advertisement
Guest User

Untitled

a guest
Aug 28th, 2018
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Awk 0.46 KB | None | 0 0
  1. BEGIN{
  2.     FS=",";
  3.     first="";
  4.     second="";
  5.     line="";
  6. }
  7. {
  8.     line=""
  9.     for(c=1;c<=NF;++c) {
  10.         if(c==i) {
  11.             first=$c;
  12.         }
  13.         if(c==j) {
  14.             second=$c;
  15.         }
  16.     }
  17.     for(c=1;c<=NF;++c) {
  18.         if(c!=i && c!=j)
  19.             line=line$c;
  20.         if(c==i)
  21.             line=line second;
  22.         if(c==j)
  23.             line=line first;
  24.         if(c!=NF)
  25.             line=line";";
  26.     }
  27.     print line;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement