bash swap two columns in a file code example
Example: bash swap two columns in a file
# Example usage:
awk '{t=$1; $1=$2; $2=t; print;}' input_file # Swap column 1 and column 2
# This assigns column 1 to a dummy variable t, makes column 1 equal
# to column 2, and then assigns the contents of t to column 2