in reply to Can anyone make this shorter?

Arr... Cheesy likes golfing...

#23456789_123456789_123456789_123456789_12345678 (48) perl -pi.bak -e's/(xyz\s*=\s*)(\d+)/$1.($2+1)/e' test.data

Update: Anything maverick can do, I can do better... (j/k):

perl -pi.bak -e'/^xyz\b/&&s/\d+$/$&+1/e' (40)

As long as your file is formatted correctly, that should avoid any trip-ups.

And a slice of -pie: Check out perlrun for all your command-line option needs. :-)

His Royal Cheeziness

Replies are listed 'Best First'.
Re: Re: Can anyone make this shorter?
by George_Sherston (Vicar) on Aug 21, 2001 at 20:37 UTC
    Excuse me whilst I bow and kiss your cycle clips. I would really love to know how that line does what it does. I get the regex stuff, but it's the perl -pi.bak -e ..... test.data bit I have no clue about. Would any monk be kind enough to enlighten me?

    § George Sherston