test a sed command?

Kevin Fries kfries6 at gmail.com
Wed Sep 14 12:07:54 MST 2011


On 09/14/2011 12:41 PM, Dazed_75 wrote:
> Thank you all.  Apparently I was not clear that I was talking about 
> doing this for a number of files and in potentially several 
> directories in a hierarchy.  Since sed seems also to have no recursive 
> directory option either, it seems I have to just know which direcories 
> have eligable files in them and do it a directory at a time.  I was 
> trying to avoid copying all the material to a test directory, but that 
> seemed the best course.  Putting Joseph's solution and Kevin's 
> suggestion together with globbed file names for a test showed me I 
> would feel pretty safe even doing this in the live directories since 
> the substitution is of IP addresses which are very definitive in form.
>
> Thanks again!

 From your top directory:

    # find . -exec sed -i.bak 's/old/new/g' {} \;

Good Luck
Kevin


More information about the PLUG-discuss mailing list