Answers for "bash swap two columns in a file"

1

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
Posted by: Guest on October-01-2020

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language