>>>>> "JG" == Jim Gibson <jimsgib...@gmail.com> writes:

  JG> On 7/21/10 Wed  Jul 21, 2010  11:51 AM, "Vaughan Williams"
  JG> <vaughan...@gmail.com> scribbled:

  >> Hi all,
  >> 
  >> I'm hope you all could help me with a very simple question.
  >> 
  >> I have a multi line text file laid out as below.
  >> 
  >> 10.10.10.45 bobs
  >> 10.10.10.34 jims
  >> 10.10.10.27 jacks
  >> .....
  >> .....
  >> 
  >> I would like to that the 10.10.10.??? and move it to the end of the same
  >> line so the output will look like.
  >> 
  >> bobs 10.10.10.45
  >> jims 10.10.10.34
  >> jacks 10.10.10.27
  >> .....
  >> .....

  JG> perl -ane 'print join(" ",reverse(@F)),"\n"' file

adding -l will eliminate the need for the "\n".

since you gave a fish (which i didn't want to do), here is my take
(untested):

        perl -pe 's/(\S+)\s+(\S+)/$2 $1/' file

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to