Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Feb 2005 12:40:04 -0500
From:      Frank Laszlo <laszlof@tvog.net>
To:        Jim Pazarena <fquest@ccstores.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: need help with script and sed
Message-ID:  <42162874.6060304@tvog.net>
In-Reply-To: <421622B0.9030600@ccstores.com>
References:  <421622B0.9030600@ccstores.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Jim Pazarena wrote:

> I would like to traverse my /users/home tree searching
> for all regular files and change any lines which read:
>   "/cgi-bin/Count.cgi ..." to:
>   "http://counter.qcislands.net/cgi-bin/Count.cgi ..."
>
> I kinda think that a 'find' with an -exec of 'sed' would do
> it but I'm not sure, and even if it were, I'm not sure of
> the syntax.
>
> Could someone help me please?
>
> Thanks!
> Jim
>

for i in `find /users/home -type f`; do
    sed -i '' 
"s|/cgi-bin/Count.cgi|http://counter.qcislands.net/cgi-bin/Count.cgi|g" $i
done

This should do the trick.

Regards,
    Frank Laszlo



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?42162874.6060304>