I have a tab separated files with entries like this:1 4 10 cat1 10 4 dogI want to process it so that if column 3 is less than column 2 they get switched, like so1 4 10 cat1 4 10 dogThis script seems to get it, but it only outputs columns that don't meet the criteria, so the output would be just1 4 10 catwhile read field1 field2 field3 field4; do  if [[ $field2 -gt $field3 ]] ; then       awk '{t=$field2; $field2=$field3; $field3=t; print; } '  fidone < filename.txtI'm sure I'm making some stupid mistake, but at the moment I'm not seeing it. 
linux while read to switch columns if column 3 is less than column 2
awk;csv;read