I have a file which contains 3 fields separated by tabs example
andrew kid baker
I need to swap kid and baker using cut and paste commands how is this to be done?
Thanks
I have a file which contains 3 fields separated by tabs example
andrew kid baker
I need to swap kid and baker using cut and paste commands how is this to be done?
Thanks
Hi, below is my suggestion.
input="test" #input stores the value of the "file" you will be using
while read a b c #creates 3 variables to store the value from the "file"
do
printf "%s\n" $a $c $b #prints out all 3 variables in a format you want"
done < $input #indicate which "file" to carry out the function
This is a simple method to solve your query. Hope it helps
awk '{print $1,$3,$2}' filename
but my instructions for the exercise say to use cut and paste commands to swap the fields is that not possible?