[NTLUG:Discuss] Quickest way to edit file?

Wayne Walker wwalker at bybent.com
Mon Jul 23 15:16:57 CDT 2007


MadHat beat me to it, but

On Mon, Jul 23, 2007 at 11:19:09AM -0500, MadHat Unspecific wrote:
> Perl
> 
>   perl -pi -e 's/email\@address\n//' file
                 s/^email\@address\n//
Or you might delete wwalker at gmail.com along with walker at gmail.com

> Not saying it is easier than vi, but it is a way of doing it in one 
> command without haveing to rename files and such.
> 
> Details for those who care:
> 
> perl - the perl command
>   -pi - use the file specified as if it were called in a while loop
>         (see perlrun for details)
	actually, the -p does the above

	-i - edit each filename passed on the command line "in place"
	-i.bak - as above but keep the original file by renaming it.

-- 

Wayne Walker

www.unwiredbuyer.com - when you just can't be by the computer

wwalker at bybent.com                    Do you use Linux?!
http://www.bybent.com                 Get Counted!  http://counter.li.org/
Perl - http://www.perl.org/           Perl User Groups - http://www.pm.org/
Jabber:  wwalker at jabber.gnumber.com   AIM:     lwwalkerbybent
IRC:     wwalker on freenode.net



More information about the Discuss mailing list