I want to know if there is a way to easier way to swap the first two words of every line. Let say my text file consist of these three lines: Mary Joe William Edward Shawn LiamUltimately I want this:  Joe Mary  Edward William Liam ShawnI know this can be done by sed command by doing this:sed -e s/\([^ ]*\) *\([^ ]*\)/\2 \1 /g fileBut thats to much to remember.Is there an easier way to do this.This is bash btw. 
Swapping the first two word of every line without using sed
text processing
With two word lines, this might be easier:awk '{print $2,$1}' fileIf you need to swap the first two words of a file with or without two words per line:awk 'NF >= 2{t=$2;$2=$1;$1=t};{print}' fileNote that this will collapse multiple spaces into one.