FW: [Gllug] Awk Sed

harry postituk at yahoo.com
Fri Dec 7 02:55:11 UTC 2001


On Thursday 06 Dec 2001 7:50 pm, Alex wrote:
>  Perl -p -i'.orig' -e 's/(Alex)/$1andria/g;' *

I did not entirely understand what you have done there as I am no Perl guru
but  another technique I found while playing with sed is this. 

Put the following in a shell script
#! /bin/sh
sed -e 's/'$2'/'$3'/g' $1 > $1ff; more $1ff > $1; rm $1ff; rm *~

Pass it something like
>$ ./harrysed textfile house maison
or
>$./harrysed sedscript.sh 's\/hte\/the\/'  's\/hte\/the\/g'


This is by nomeans a great way of doing it but it does seem to work for 
individual files. I will not be using it until I hear from the list first 
though as I am sure its just an accident waiting to happen. I think it was 
Formi who said about not being able to replace text in a file but I have 
tried this and it seems to work for single files but this does not solve my 
multiple file problem. I think the above could be modified to run through 
multiple files in some manner but it is 02:40 and my head hurts.

I need to learn more Perl as it keeps coming up as the best utility for the
job on more occasions than I care to remember.
--

Harry Jackson


14

"The extension of womens rights is the basic principle of all social
progress."
Charles Fourier

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list