Hello All,
Text file contains lines built from different number of columns. I need to move last column of each line to the begining of that line. The columns are separated with different numbers of spaces and tabs. How to get the output file containing last column of each line from input file on the begining and all columns being separated with only one space.
Is it possible to do it with awk too?
eg. input file
col1 col2 col3[tab]col4 col5
col1[tab]col2 col3[tab][tab]col4
col1 col2 col3 col4
col1 col2 col3[tab] col4 col5 col5
eg. output file
col5 col1 col2 col3 col4
col4 col1 col2 col3
col4 col1 col2 col3
col5 col1 col2 col3 col4
Thank you in advance,
Chris
Text file contains lines built from different number of columns. I need to move last column of each line to the begining of that line. The columns are separated with different numbers of spaces and tabs. How to get the output file containing last column of each line from input file on the begining and all columns being separated with only one space.
Is it possible to do it with awk too?
eg. input file
col1 col2 col3[tab]col4 col5
col1[tab]col2 col3[tab][tab]col4
col1 col2 col3 col4
col1 col2 col3[tab] col4 col5 col5
eg. output file
col5 col1 col2 col3 col4
col4 col1 col2 col3
col4 col1 col2 col3
col5 col1 col2 col3 col4
Thank you in advance,
Chris