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:
fjfjf fjfjf fjfjf <?Pub fontsize="10.00pt"?> ghg gghg fgf gf gjgjg gjgjg gjgjg <?Pub fontsize="9.00pt"?> gggg dfd dfdf dfd <?Pub fontsize= "19.00pt"?> fgf fgfg gfff fgf fggf ghg ghgghhg ghghg
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 ?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: search and replace question
by almut (Canon) on Mar 11, 2010 at 08:31 UTC | |
|
Re: search and replace question
by Hue-Bond (Priest) on Mar 11, 2010 at 08:21 UTC | |
|
Re: search and replace question
by jwkrahn (Abbot) on Mar 11, 2010 at 10:57 UTC |