willa has asked for the wisdom of the Perl Monks concerning the following question:

How do I put an apostrophe in front of every date in a file? The dates are of the form xx/xx/xxxx. Thanks.

Janitored by Arunbear - retitled from 'Another easy one-liner', as per Monastery guidelines

  • Comment on How do I put an apostrophe in front of every date in a file?

Replies are listed 'Best First'.
Re: How do I put an apostrophe in front of every date in a file?
by zejames (Hermit) on Oct 21, 2004 at 11:22 UTC
    Warning : this code is untested.

    perl -i.bak -ne "s!(\d{2}/\d{2}/\d{4})!'$1!g" myfile

    --
    zejames
Re: How do I put an apostrophe in front of every date in a file?
by Anonymous Monk on Oct 21, 2004 at 11:36 UTC