Sorry...the -F - needs to come first on the awk command line, before the
search string /^sender/


Adam Maloney
Systems Administrator
Sihope Communications

On Fri, 15 Sep 2000, Adam Maloney wrote:

> Let's say you have:
> 
> file1.txt
> sender = list1-bill
> 
> file2.txt
> sender = list2-joe
> 
> you'd do:
> cat file1.txt | awk /^sender/ -F - '{ printf("sender = %s-%s\n", $2, $1)
> }'
> 
> should give you:
> sender = bill-list1 for file1.
> 
> So you'd script it like:
> 
> #!/bin/sh
> for nerp in `ls /usr/local/majordomo/lists/config*`
> do
>   cat $nerp | awk /^sender/ -F - '{ printf("sender = %s-%s\n", $2, $1) }'
> > /tmp/nerp.$$
>   cp /tmp/nerp.$$ /usr/local/majordomo/lists/$nerp
> done;
> 
> or something like that.  Test it first!
> 
> Adam Maloney
> Systems Administrator
> Sihope Communications
> 
> On Fri, 15 Sep 2000, mjn wrote:
> 
> > I have a huge directory of config files for some majordomo lists, all of
> > which have one line which I want to change.
> > 
> > Now I have been doing some perl scripting for awhile, i am still quite
> > green, but it always seems to take me twice the time to code the script
> > than would have been just to do the manual edit.
> > 
> > Anyone know an easy way to change all of these files?  It is going to have
> > to involve some reg-exp because the variable is sender = owner-listname
> > which needs to be changed to listname-owner.
> > 
> > The regexp manuevering isn't really a problem, I have something that will
> > do that actually.  The place where I usually run into problems is the
> > gathering of filenames and then the interaction with those files...
> > 
> > so anyone got a quick answer to this problem?
> > 
> > ____________________________
> > Mike Neuharth
> > ADCS Technology Specialist
> > http://www.umn.edu/adcs
> > 
> > E-Mail		: mjn at umn.edu
> > Page Mail	: 6126486512 at page.metrocall.com
> > http://nifty.dsl.visi.com/
> > ____________________________
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tclug-list-unsubscribe at mn-linux.org
> > For additional commands, e-mail: tclug-list-help at mn-linux.org
> > 
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tclug-list-unsubscribe at mn-linux.org
> For additional commands, e-mail: tclug-list-help at mn-linux.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tclug-list-unsubscribe at mn-linux.org
For additional commands, e-mail: tclug-list-help at mn-linux.org