On Wed, Jan 29, 2003 at 12:49:40AM +0100, Paul Johnson wrote:
> 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)/'
> > This should start a good TIMTOWTDI thread :)
> If you insist:
> echo 123456 | perl -lne 'print join "-", /../g'

Harrumph.  Back in my day we didn't have perl, we had to chisel our
programs into lumps of coal in just the right way that the patterns
in the smoke would display the right result.  We used incantations
like this:

echo 123456 | awk 'BEGIN {FS=""} {print $1$2"-"$3$4"-"$5$6}'

-- 
David Cantrell | Member of the Brute Squad | http://www.cantrell.org.uk/david

    Usenet is a co-operative venture, backed by nasty people.
    Follow the standards.
      -- Chris Rovers, in the Monastery

Reply via email to