Re: Elegant way to find/remove line from text file

2001-11-29 Thread John W. Krahn
Jim Witte wrote: > > Hello, > > I'm updating a script that manages the .htpasswd file on *N*X boxes. > The user records are stored on successive lines, in the form > $username:$password. What I want to do is find a particular $username, > then delete the entire line. Perhaps this module has

Re: Elegant way to find/remove line from text file - REDUX

2001-11-29 Thread Randal L. Schwartz
> "A" == A Rivera <[EMAIL PROTECTED]> writes: A> Wouldn't A> cat filename | grep -v "text to ignore" A> be simplest? I'd consider grep -v "text to ignore" filename simpler, and it avoids the useless use of cat. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 5

Re: Elegant way to find/remove line from text file - REDUX

2001-11-29 Thread A. Rivera
Wouldn't cat filename | grep -v "text to ignore" be simplest? Agustin - Original Message - From: "Jim Witte" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, November 29, 2001 8:09 AM Subject: Elegant way t

RE: [Bob_Showalter@taylorwhite.com: RE: Elegant way to find/remove line from text file]

2001-11-29 Thread Bob Showalter
> -Original Message- > From: Bkwyrm [mailto:[EMAIL PROTECTED]] > Sent: Thursday, November 29, 2001 12:22 PM > To: [EMAIL PROTECTED] > Subject: [[EMAIL PROTECTED]: RE: Elegant way to > find/remove > line from text file] > > > Tested these in order to lear

Elegant way to find/remove line from text file - REDUX

2001-11-29 Thread Bkwyrm
> perl -ni -e 'next unless /foo/' myfile.txt Actually, finally got this to work this way to remove all lines but those containing foo: perl -ni -e 'next unless /foo/; print;' myfile.txt and this way for all those not containing foo: perl -ni -e 'next if /foo/; print;' myfile.txt -- Na

[Bob_Showalter@taylorwhite.com: RE: Elegant way to find/remove line from text file]

2001-11-29 Thread Bkwyrm
Tested these in order to learn how they work, and the first one simply deleted the entire contents my test file which was peppered with foo on multiple (but not all) lines - Forwarded message from Bob Showalter <[EMAIL PROTECTED]> - Second, the canonical one-liner to delete lines f

RE: Elegant way to find/remove line from text file

2001-11-29 Thread Bob Showalter
> -Original Message- > From: Jim Witte [mailto:[EMAIL PROTECTED]] > Sent: Thursday, November 29, 2001 11:09 AM > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: Elegant way to find/remove line from text file > > > Hello, > > I'm updating a scr

Elegant way to find/remove line from text file

2001-11-29 Thread Jim Witte
Hello, I'm updating a script that manages the .htpasswd file on *N*X boxes. The user records are stored on successive lines, in the form $username:$password. What I want to do is find a particular $username, then delete the entire line. The current code reads the entire file into an array,