Re: regex question

2008-04-13 Thread Alex Samad
On Sun, Apr 13, 2008 at 08:00:00AM -0700, Daniel Burrows wrote: > On Sun, Apr 13, 2008 at 10:00:42PM +1000, Alex Samad <[EMAIL PROTECTED]> was > heard to say: > > On Sat, Apr 12, 2008 at 06:26:26PM -0700, Daniel Burrows wrote: > > > On Sun, Apr 13, 2008 at 09:37:02AM +1000, Alex Samad <[EMAIL PROT

Re: regex question

2008-04-13 Thread Alex Samad
On Sun, Apr 13, 2008 at 09:21:51AM -0500, Mumia W.. wrote: > On 04/13/2008 07:00 AM, Alex Samad wrote: >> Yes I did (thanks twice), but my question which arose from this was why >> this did not work >> >> perl -nle 'next if ( /^\s*;/); print' sip.conf >> >> why do I need the length statement[?] >

Re: regex question

2008-04-13 Thread Daniel Burrows
On Sun, Apr 13, 2008 at 10:00:42PM +1000, Alex Samad <[EMAIL PROTECTED]> was heard to say: > On Sat, Apr 12, 2008 at 06:26:26PM -0700, Daniel Burrows wrote: > > On Sun, Apr 13, 2008 at 09:37:02AM +1000, Alex Samad <[EMAIL PROTECTED]> > > was heard to say: > > > this started out as a grep quetion

Re: regex question

2008-04-13 Thread Mumia W..
On 04/13/2008 07:00 AM, Alex Samad wrote: Yes I did (thanks twice), but my question which arose from this was why this did not work perl -nle 'next if ( /^\s*;/); print' sip.conf why do I need the length statement[?] perl -nle 'next if ( /^\s*;/); print if length $_ > 0' sip.conf [...]

Re: regex question

2008-04-13 Thread Alex Samad
On Sat, Apr 12, 2008 at 06:26:26PM -0700, Daniel Burrows wrote: > On Sun, Apr 13, 2008 at 09:37:02AM +1000, Alex Samad <[EMAIL PROTECTED]> was > heard to say: > > this started out as a grep quetion > > > > trying to look at a file with out the comments in it > > > > i tried grep -v '^\s*;' ; is

Re: regex question

2008-04-13 Thread Alex Samad
On Sun, Apr 13, 2008 at 11:22:13AM +1000, Owen Townend wrote: > On 13/04/2008, Alex Samad <[EMAIL PROTECTED]> wrote: > > > > this started out as a grep quetion > > > > trying to look at a file with out the comments in it > > > > i tried grep -v '^\s*;' ; is the comment delimiter. > > > > but this

Re: regex question

2008-04-12 Thread Bob Proulx
Alex Samad wrote: > trying to look at a file with out the comments in it > i tried grep -v '^\s*;' ; is the comment delimiter. > but this left me with lots of blank lines. Try this: sed 's/[[:space:]]*;.*//' file | less -s The 'less -s' squeezes consecutive blank lines. See also 'more -s' an

Re: regex question

2008-04-12 Thread Daniel Burrows
On Sun, Apr 13, 2008 at 09:37:02AM +1000, Alex Samad <[EMAIL PROTECTED]> was heard to say: > this started out as a grep quetion > > trying to look at a file with out the comments in it > > i tried grep -v '^\s*;' ; is the comment delimiter. > > but this left me with lots of blank lines. Hav

Re: regex question

2008-04-12 Thread Owen Townend
On 13/04/2008, Alex Samad <[EMAIL PROTECTED]> wrote: > > this started out as a grep quetion > > trying to look at a file with out the comments in it > > i tried grep -v '^\s*;' ; is the comment delimiter. > > but this left me with lots of blank lines. > Hey, Try this: `sed -e 's:;.*::' -e ':^$:

Re: regex question

2008-04-12 Thread Douglas A. Tutty
On Sun, Apr 13, 2008 at 09:37:02AM +1000, Alex Samad wrote: > this works > perl -e 'while(<>){chomp ; next if ( /^\s*;/); print "[$_]\n" if length > $_ > 0}' sip.conf > > or this > perl -nle 'next if ( /^\s*;/); print if length $_ > 0' sip.conf > > why doesn't the next force a read of a new

Re: Regex Question

2007-07-18 Thread Bob McGowan
Daniel Burrows wrote: On Mon, Jul 16, 2007 at 09:43:32AM -0700, Bob McGowan <[EMAIL PROTECTED]> was heard to say: Next, grep supports what most would now call a subset of full regular expression syntax. This does not include parenthesis or alternation. So when you put a backslash in front of

Re: Regex Question

2007-07-18 Thread Daniel Burrows
On Mon, Jul 16, 2007 at 09:43:32AM -0700, Bob McGowan <[EMAIL PROTECTED]> was heard to say: > Next, grep supports what most would now call a subset of full regular > expression syntax. This does not include parenthesis or alternation. So > when you put a backslash in front of the pipe symbol, '

Re: Regex Question

2007-07-16 Thread Bob McGowan
Telly Williams wrote: Hi, I'm reading up on Regular Expressions and I have a question about alternation. I have the sentences: "There was a dog in the house." & "A house on the hill." Both of these are in a file (named "regex") on two different lines. My unde

Re: Regex Question

2007-07-13 Thread Florian Kulzer
On Fri, Jul 13, 2007 at 15:49:23 -0600, Telly Williams wrote: > Hi, > > I'm reading up on Regular Expressions and I have a question about > alternation. > > I have the sentences: "There was a dog in the house." & "A house on > the hill." > > Both of these are in a file (named "regex") on two diffe

Re: Regex Question

2007-07-13 Thread Brad Rogers
On Fri, 13 Jul 2007 14:56:39 -0700 Steven Ringwald <[EMAIL PROTECTED]> wrote: Hello Steven, > I think egrep handles regular expressions, while grep just does the > simple string matching. "egrep" is simply a bash script that calls "grep -E" "fgrep" does something similar. -- Regards _

Re: Regex Question

2007-07-13 Thread William Pursell
Telly Williams wrote: I'm reading up on Regular Expressions and I have a question about alternation. I have the sentences: "There was a dog in the house." & "A house on the hill." Both of these are in a file (named "regex") on two different lines. My underst

Re: Regex Question

2007-07-13 Thread Steven Ringwald
Telly Williams wrote: Hi, I'm reading up on Regular Expressions and I have a question about alternation. I have the sentences: "There was a dog in the house." & "A house on the hill." Both of these are in a file (named "regex") on two different lines. My unde

Re: Regex Question

2007-07-13 Thread Alex Samad
On Fri, Jul 13, 2007 at 03:49:23PM -0600, Telly Williams wrote: > Hi, > > I'm reading up on Regular Expressions and I have a question about > alternation. > > I have the sentences: "There was a dog in the house." & "A house on the > hill." > > Both of these are in a file (nam

Re: REGEX question

2002-01-22 Thread martin f krafft
also sprach Mark Ferlatte <[EMAIL PROTECTED]> [2002.01.22.1914 +0100]: > > How can I match the same character repeated n times? > > ".{n}" matches any n characters. > > "a{3}" will match aaa, , and a. but only aaa, and so on. not *any* letter repeated n times. i had a hard time inter

Re: REGEX question

2002-01-22 Thread Henry House
On Mon, Jan 21, 2002 at 05:07:21PM -0500, Alec wrote: > Hi > > How can I match the same character repeated n times? > ".{n}" matches any n characters. You want to remember the first character and match the same using a backreference. In grep: \(.\)\1 In egrep, perl, or ruby: (.

Re: REGEX question

2002-01-22 Thread Mark Ferlatte
On Mon, Jan 21, 2002 at 05:07:21PM -0500, Alec wrote (1.00): > How can I match the same character repeated n times? > ".{n}" matches any n characters. "a{3}" will match aaa, , and a. "b{7}" will match bbb, etc. HTH, M pgpqK6YENOpuY.pgp Description: PGP signature

Re: REGEX question

2002-01-21 Thread Michael P. Soulier
On 21/01/02 Alec did speaketh: > Hi > > How can I match the same character repeated n times? > ".{n}" matches any n characters. How about this: /(.)\1{n-1}/ I'm assuming perl syntax, so adjust accordingly. Mike -- Michael P. Soulier <[EMAIL PROTECTED]>, GnuPG pub key: 5BC8BE08 "...the word