Menu{Master,Maestro,etc} question(s)
Fairlight
fairlite at fairlite.com
Thu May 10 06:53:57 PDT 2007
At Thu, May 10, 2007 at 09:34:28AM -0400 or thereabouts,
suspect Jay Ashworth was observed uttering:
> On Tue, May 08, 2007 at 11:47:32PM -0400, Fairlight wrote:
> > perl -pi.bak -e '$line = shift; $sub = shift; while (<>) {if ($_ =~ /^${line}:/)
> > {s/^(.+:[^:]+")[^"]+(".*)/$1${sub}$2/;}}' $2 $3 $1
> >
> > I never use -pi so once I looked it up, I realised you didn't need the
> > print; in there. The important parts are the test and the regex anyway,
> > but for the sake of not conflicting...
>
> I think you actually don't need the "while", either, no?
I didn't test with -pi.bak so I can't authoritatively say.
The man page said that -i edited in-place all lines passed through the <>
operator. I would then surmise that if you don't use the <> operator, it's
not done. I just haven't tested the theory. Your version as I recall it
did not seem to actually -take- the input from STDIN or a file, although I
could be misremembering (it's not in front of me).
Easy test is to just drop the whole "if" block you had and replace it with
a single print; at that point. If you actually get output to your
terminal that matches what you thought you fed it, then you're right. If
it does nothing, I'm right.
mark->
--
No matter what your problems, modern medicine can help!
http://members.iglou.com/fairlite/fixital/
More information about the Filepro-list
mailing list