Re: mass word find/replace
Mark wrote: I am trying to find a way to replace one word in a file with another word, like windows wordpad find/replace. I need to change pn_ to nuke_ and have a 188000 lines to do it on. ugh perl -i.bak -pe 's/pn_/nuke_/g' /input/file(s) The old file(s) will be saved with the extension .bak. -- Cheers, Bernard ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: mass word find/replace
load it up in vi and type: :%s/pn_/nuke_/g Lance At 09:21 AM 1/7/2004, you wrote: I am trying to find a way to replace one word in a file with another word, like windows wordpad find/replace. I need to change pn_ to nuke_ and have a 188000 lines to do it on. ugh thanks Mark ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.558 / Virus Database: 350 - Release Date: 1/2/2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.558 / Virus Database: 350 - Release Date: 1/2/2004 ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: mass word find/replace
sed(1) should be able do the trick. sed -e /pn_/s//nuke_/g * The above command should replace all pn_ to nuke_ in all files in the directory you run the command. /Björn I am trying to find a way to replace one word in a file with another word, like windows wordpad find/replace. I need to change pn_ to nuke_ and have a 188000 lines to do it on. ugh thanks Mark ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED] ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: mass word find/replace
On Wed, Jan 07, 2004 at 04:30:34PM +0100, Björn Andersson wrote: sed(1) should be able do the trick. sed -e /pn_/s//nuke_/g * The above command should replace all pn_ to nuke_ in all files in the directory you run the command. Except that will print the result to stdout -- I suspect that the OP would find an in-place edit more useful, like so: sed -i.bak -e 's/pn_/nuke_/g' filenames (Or any of the other responses in this thread.) Cheers, Matthew -- Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks Savill Way PGP: http://www.infracaninophile.co.uk/pgpkey Marlow Tel: +44 1628 476614 Bucks., SL7 1TH UK pgp0.pgp Description: PGP signature