Re: [gentoo-user] About sed

2005-11-09 Thread Neil Bothwick
On Tue, 8 Nov 2005 23:37:52 -0500, Walter Dnes wrote: > That is not what sed is designed to do. "sed" is "Streaming EDitor". > You specify an input file, and the changed file goes to STDOUT. If you > want to change the original file, you need to use "ed". Or use sed's -i or --in-place argumen

Re: [gentoo-user] About sed

2005-11-08 Thread Walter Dnes
On Mon, Nov 07, 2005 at 03:38:00AM -0200, Rafael Barreto wrote > Is this right? Well, what I really want is replace just CLOCK="fool1" > by CLOCK="fool2" keeping the comments in line. That is not what sed is designed to do. "sed" is "Streaming EDitor". You specify an input file, and the changed

Re: [gentoo-user] About sed

2005-11-07 Thread Alexander Skwar
Rafael Barreto wrote: > Hi, > > I'm learning about the use of the sed command and I have some questions. > I'm trying to read in /etc/conf.d/clock the CLOCK variable with: > > sed '/^CLOCK="*"$/p' /etc/conf.d/clock > > This command, in principe, must print in screen the line that contains > CLOC

Re: [gentoo-user] About sed

2005-11-06 Thread gentuxx
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Willie Wong wrote: >On Sun, Nov 06, 2005 at 09:03:01PM -0800, gentuxx wrote: > >>sed -n '/^CLOCK=/s/^\(CLOCK=".*"\).*$/\1/p /etc/conf.d/clock >> > >Ah, yes, I misunderstood the OP. I thought he didn't want the lines >with trailing comments at all. >

Re: [gentoo-user] About sed

2005-11-06 Thread Willie Wong
On Mon, Nov 07, 2005 at 03:42:05AM -0200, Rafael Barreto wrote: > Other thing... Why was necessary to ^CLOCK= before > s/^\(CLOCK=".*"\).*$/\1/p? And which the necessity of the ( ) between the > regular expression? as I just posted in another post, the /^CLOCK/ should not be strictly necessary.

Re: [gentoo-user] About sed

2005-11-06 Thread Willie Wong
On Sun, Nov 06, 2005 at 09:03:01PM -0800, gentuxx wrote: > sed -n '/^CLOCK=/s/^\(CLOCK=".*"\).*$/\1/p /etc/conf.d/clock > Ah, yes, I misunderstood the OP. I thought he didn't want the lines with trailing comments at all. But is it necessary to give the address for an s// replacement? As I under

Re: [gentoo-user] About sed

2005-11-06 Thread gentuxx
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Rafael Barreto wrote: > Other thing... Why was necessary to ^CLOCK= before s/^\(CLOCK=".*"\).*$/\1/p? And which the necessity of the ( ) between the regular expression? > > Thanks again > Sorry for things being out of order, but you top-posted. The

Re: [gentoo-user] About sed

2005-11-06 Thread Rafael Barreto
Other thing... Why was necessary to ^CLOCK= before s/^\(CLOCK=".*"\).*$/\1/p? And which the necessity of the ( ) between the regular _expression_? Thanks again 2005/11/7, Rafael Barreto <[EMAIL PROTECTED]>: For that I understood, this command will return the line of CLOCK= in /etc/conf.f/clock wit

Re: [gentoo-user] About sed

2005-11-06 Thread Rafael Barreto
For that I understood, this command will return the line of CLOCK= in /etc/conf.f/clock without any comments. Is this right? Well, what I really want is replace just CLOCK="fool1" by CLOCK="fool2" keeping the comments in line. By the way, \1 do really what? If i put \0 the result is the entire lin

Re: [gentoo-user] About sed

2005-11-06 Thread gentuxx
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Willie Wong wrote: >On Mon, Nov 07, 2005 at 01:44:42AM -0200, Rafael Barreto wrote: > >>Hi, >> >>I'm learning about the use of the sed command and I have some questions. I'm >>trying to read in /etc/conf.d/clock the CLOCK variable with: >> >>sed '/^CL

Re: [gentoo-user] About sed

2005-11-06 Thread Rafael Barreto
:) Thanks very much. Now that I read your answear I searched in a book the significant of *,+ and others and I suppose I understood. Thanks2005/11/7, Willie Wong <[EMAIL PROTECTED]>: On Mon, Nov 07, 2005 at 01:44:42AM -0200, Rafael Barreto wrote:> Hi,>> I'm learning about the use of the sed comma

Re: [gentoo-user] About sed

2005-11-06 Thread Willie Wong
On Mon, Nov 07, 2005 at 01:44:42AM -0200, Rafael Barreto wrote: > Hi, > > I'm learning about the use of the sed command and I have some questions. I'm > trying to read in /etc/conf.d/clock the CLOCK variable with: > > sed '/^CLOCK="*"$/p' /etc/conf.d/clock > > This command, in principe, must pri

[gentoo-user] About sed

2005-11-06 Thread Rafael Barreto
Hi, I'm learning about the use of the sed command and I have some questions. I'm trying to read in /etc/conf.d/clock the CLOCK variable with: sed '/^CLOCK="*"$/p' /etc/conf.d/clock This command, in principe, must print in screen the line that contains CLOCK= in the begin, contains anything betwe