[Gllug] Awk Sed

Stig Brautaset stigbrau at start.no
Thu Dec 6 20:18:59 UTC 2001


* harry <postituk at yahoo.com> spake thus:
> Hi all
> 
> If I wanted to change the same pattern in mutiple files held in a directory 
> do I use sed or awk.  I hate going into each file and using vi. I want the 
> text to be modified in the file and not redirected to another place.
> 
> Also is there anywhere on a linux machine where you can get  decent examples 
> of how to use a tool. I know that the man pages are there but they are an 
> absolute nightmare to decipher.

$ sed -e 's/1/2/g' file > c && mv c file

will change all occurences of "1" to "2" in file. I don't think sed can
do in-file replacements though, but I am sure someone can prove me wrong
(I would be quite glad if someone could, because I have missed that
feature).

Regards,
Stig

-- 
brautaset.org
Registered Linux User 107343

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




More information about the GLLUG mailing list