TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [TCLUG:21324] Probably an easy sh/perl question...
If all you want to do is swap owner-listname to listname-owner in a bunch of
files, this will work:
perl -i.bak -pe 's/(\S*)-(\S*)/$2-$1/' *
This will in-place edit all the files in the current directory and save the
originals with a .bak extension. Owner and listname are assumed to consist
of non-space characters and no dash.
Patrick McCabe
----- Original Message -----
From: mjn <mjn@umn.edu>
To: <tclug-list@mn-linux.org>
Sent: Friday, September 15, 2000 9:34 AM
Subject: [TCLUG:21324] Probably an easy sh/perl question...
> 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@umn.edu
> Page Mail : 6126486512@page.metrocall.com
> http://nifty.dsl.visi.com/
> ____________________________
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tclug-list-unsubscribe@mn-linux.org
> For additional commands, e-mail: tclug-list-help@mn-linux.org
>
>