2
I have a text file (actually XML) that I want to be able to change using a command line. In other words, as part of a Windows batch, I want to locate a string (in this case @@@@, which uses a character not present anywhere else in the file), and then replace it with something simple, such as a date '8/18/11'.
Is there some kind of 'grep', 'perl' or other type of way to, in short order, just replace the string -- again, this has to be via the command line, since I want to automate the process.
Incidentally, I have Active State PERL on my PC.
On Windows you should normally use " not ' to enclose argument strings. – RedGrittyBrick – 2011-08-19T16:31:58.747
1Nifle: Very nice answer. On my Vista box, I had to make two modifications: "can't do inplace edit without backup" was an error that I got. And, since the date necessarily uses the '/' char, I switched to use '#' as a delimiter. So here it is perl -pi.bak -e 's#@@@@#8/19/11#g' Edittable-failsafe.pga – Rolnik – 2011-08-19T16:39:02.700