[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gentoo-user
Subject:    Re: [gentoo-user] OT: global search and replace
From:       Billy Holmes <billy () gonoph ! net>
Date:       2004-09-09 14:07:40
Message-ID: 414063AC.8060500 () gonoph ! net
[Download RAW message or body]

Andrew Ross wrote:
> # Do the substitution on all files in current dir and subdirs
> ( find . ) | while read FILE
> do
> 	sed -i 's/oldhostname/newhostname/g' "${FILE}"
> done
> 
> # Remove temp files created by sed
> for TMP_FILE in $(find . -empty -name 'sed*')
> do
> 	rm ${TMP_FILE}
> done

perl makes this easier..

find . -print0 | xargs -0 perl -i -p -e 's/oldhostname/newhostname/g'

--
gentoo-user@gentoo.org mailing list

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic