Friday, November 13, 2009

Convert text: to :text

Taken from:
http://discussions.apple.com/thread.jspa?messageID=9912722

Convert:
      Test:
To:
      :Test

Method 1:
      awk '{print $1}' | sed s/:// | awk '{print ":"$1}'
Method 2:
      sed '/:/s/\(.*\):/:\1/'
Method 3:
      perl -ne 's/(\w+):/:$1/;print'
Method 4:
      awk '/:/{sub(":","");sub("^",":")}{print}'

-Brian

No comments:

Post a Comment