Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Flip fields

Status
Not open for further replies.

kHz

MIS
Dec 6, 2004
1,359
US
I know this is insanely easy, but for the life of me I cannot think of the correct way to do it.

Example file:
abc 123
def 456

Want:
123 abc
456 def

Thanks.
 
A starting point:
awk '{print $2,$1}' /path/to/input > output

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Ok thanks. When I originally did it I didn't have it '{print $2" "$1}' but '{print $2 $1}' which ran everything together and I didn't look close enough to notice until you confirmed. When I ran it again after your input I got the same results I had and then looked closer.

Thanks for acknowledging my thoughtlessness!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top