On Tue, Jan 28, 2003 at 11:35:29PM +0000, Paul Makepeace wrote:
> On Tue, Jan 28, 2003 at 11:22:48PM +0000, Phil Pereira wrote:
> > Is there an easy way to split "123456" into "12-34-56"?
> 
> $ perl -lne 'print "$1-$2-$3" if /(\d\d)(\d\d)(\d\d)/'
> 123456
> 12-34-56
> $
> 
> This should start a good TIMTOWTDI thread :)

If you insist:

echo 123456 | perl -lne 'print join "-", /../g'

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

Reply via email to