Re: ack (was: a simple question about grep)

2007-10-19 Thread Kent Johnson
Bill Ricker wrote: The Andy and the ack project have built a better grep with perl. http://perladvent.pm.org/2006/5/ search.cpan.org/~petdance/ack/ack petdance.com/ack/ Thank you again for pointing this out! I use ack several times a week, if not daily. It has saved me from having to

Re: a simple question about grep

2007-09-10 Thread Jerry
Thank you for all the great solutions! Because of my extremely limited *nix knowledge, I'd use the approach of two grep's in a pipeline, such as the one grep '^\*' yourFile | grep -v '^\*INDICATOR' suggested by Michael, as it's simple to understand and easy to memorize. Thank you again. Zhao

Re: a simple question about grep

2007-09-07 Thread Tom Buskey
On 9/6/07, Kent Johnson [EMAIL PROTECTED] wrote: Tom Buskey wrote: On 9/6/07, *G.O.* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: egrep ^\*[^INDICATOR] filename.txt That excludes lines beginning with * and any of the characters INDCATOR, i.e. *N, *D, etc will all be

Re: a simple question about grep

2007-09-07 Thread Kent Johnson
Bill Ricker wrote: Or, if you only have an old grep, but do have Perl, the following should work: The Andy and the ack project have built a better grep with perl. Cool. By default ack ignores plain text files, so you have to tell it to include them even when explicitly specifying the

Re: a simple question about grep

2007-09-07 Thread Ben Scott
On 9/7/07, Tom Buskey [EMAIL PROTECTED] wrote: egrep -P ^\*(?!INDICATOR) filename.txt GNU egrep 2.5.1 doesn't work: $ egrep '^\*(?!INDICATOR)' z $ You need to specify -P (or --perl) to turn on support for Perl regular expression extensions.Otherwise it will interpret the (? as...

Re: a simple question about grep

2007-09-07 Thread Shawn K. O'Shea
Will if you're going to go into 3-letter tools that start with 'a' that can do the requested task, then I'm just going to have to tell everyone how to do it with awk awk '/^\*/ !/^\*INDICATOR/ { print $0 }' file awk takes a pattern and then a set of things to do with lines that match that

a simple question about grep

2007-09-06 Thread Jerry
Hi, I have a text file whose content looks like below: *INDICATOR name1 zip1 geoid gender location *INDICATOR name2 zip2 *geoid gender location INDICATOR name3 zip3 *district court I want to pick up all lines starting with * but no INDICATOR followed. So for the example above, I want to pick

Re: a simple question about grep

2007-09-06 Thread Michael ODonnell
grep '^\*' yourFile | grep -v '^\*INDICATOR' ___ gnhlug-discuss mailing list gnhlug-discuss@mail.gnhlug.org http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/

Re: a simple question about grep

2007-09-06 Thread Tom Buskey
egrep '^\*' FILE | egrep -v '^\*INDICATOR' I'm not sure how you'd combine them into one REGXP. I'm sure there's a better way in perl (GNU egrep will do perl with -P) On 9/6/07, Jerry [EMAIL PROTECTED] wrote: Hi, I have a text file whose content looks like below: *INDICATOR name1 zip1

Re: a simple question about grep

2007-09-06 Thread Star
I want to pick up all lines starting with * but no INDICATOR followed. I'd double-grep it, but i'm not infront of a *nix box to check grep -i * | grep -v *INDICATOR filename or something to that effect. -- ~ * ___ gnhlug-discuss mailing list

Re: a simple question about grep

2007-09-06 Thread G.O.
egrep ^\*[^INDICATOR] filename.txt gurhan On 9/6/07, Jerry [EMAIL PROTECTED] wrote: Hi, I have a text file whose content looks like below: *INDICATOR name1 zip1 geoid gender location *INDICATOR name2 zip2 *geoid gender location INDICATOR name3 zip3 *district court I want to

Re: a simple question about grep

2007-09-06 Thread Tom Buskey
On 9/6/07, G.O. [EMAIL PROTECTED] wrote: egrep ^\*[^INDICATOR] filename.txt gurhan That didn't work for me, but this did: egrep '^\*[^I][^N][^I][^D][^I][^C][^A][^T][^O][^R]' filename.txt On 9/6/07, Jerry [EMAIL PROTECTED] wrote: Hi, I have a text file whose content looks like

Re: a simple question about grep

2007-09-06 Thread Kent Johnson
Tom Buskey wrote: On 9/6/07, *G.O.* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: egrep ^\*[^INDICATOR] filename.txt That excludes lines beginning with * and any of the characters INDCATOR, i.e. *N, *D, etc will all be excluded. That didn't work for me, but this did:

Re: a simple question about grep

2007-09-06 Thread Ben Scott
On 9/6/07, Kent Johnson [EMAIL PROTECTED] wrote: perhaps this: egrep -P ^\*(?!INDICATOR) filename.txt Assuming your grep supports the Perl regular expression extensions (a useful thing to have), that should work. Or, if you only have an old grep, but do have Perl, the following should

Re: a simple question about grep

2007-09-06 Thread Bill Ricker
Or, if you only have an old grep, but do have Perl, the following should work: The Andy and the ack project have built a better grep with perl. http://perladvent.pm.org/2006/5/ search.cpan.org/~petdance/ack/ack petdance.com/ack/ ack is pure Perl, so consistent across all platforms. Command