Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
search and replace questionby Anonymous Monk |
on Mar 11, 2010 at 07:48 UTC ( [id://827970]=perlquestion: print w/replies, xml ) | Need Help?? |
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question: I am cleaning up a bunch of data and am putting together a series of perl commands to do the job. The data to work on looks something like this:
I need to simply remove the '<?Pub XXXX ?>' strings. I am using a command like this: find ./MMData -iname '*.dita*' -print|xargs perl -pi -e 's/<\?Pub fontsize\="0.50pt"\?\>/<\!\-\-Rem Pub Dir\-\-\>/g';I've tried wildcard'ing the search string but cannot get it to work - I always seem to end up greedily taking up a lot of the rest of the file Also - I cannot get my search to find these "search strings" that are split over a line - I guess if I can get the wildcard working I could put a linefeed in there ? Also - now that I'm asking (!!!), how do I make this command NOT produce a BAK file ?
Back to
Seekers of Perl Wisdom
|
|