Re: coloring ~N by way of external file query?

2002-02-01 Thread Carl B. Constantine

* Brian Clark ([EMAIL PROTECTED]) wrote:
 * Brian Clark ([EMAIL PROTECTED]) [Feb 01. 2002 00:33]:
 
   $ cat dynacolor.sh
   #!/bin/sh
   awk '{printf(color index yellow default \~f %s ~N\\n, $1);}' addrs.txt
 
 By the way, if anyone else wants to do this and the lines in addrs.txt
 have spaces, use $0 rather than $1.
 
 awk '{printf(color index yellow default \~f \\\%s\\\ ~N\\n, $0);}'  addrs.txt
 
 Thank, David. Neat trick.

Indeed. A variation of this would be to provide different colors for
different people. For example, feegee would be yellow, but heegee would
be red.

-- 
Carl B. Constantine University of Victoria
Programmer Analyst  http://www.uvic.ca
UNIX System Administrator   Victoria, BC, Canada
[EMAIL PROTECTED]



Re: coloring ~N by way of external file query?

2002-01-31 Thread Cameron Simpson

On 23:54 31 Jan 2002, Brian Clark [EMAIL PROTECTED] wrote:
| What I'm asking is, is there a way to query an external file full of
| addresses in order to determine if the message should be a certain color
| in the index?
| 
| IOW, I'm trying to replace these (a lot more than 3):
| 
| color index yellow default ~f feefee ~N
| color index yellow default ~f geegee ~N
| color index yellow default ~f heehee ~N
| 
| With one line that gets the list from a file (via grep?).

A wrapper for mutt? Which generates a line like this:

color index yellow default ~f (feefee|geegee|heehee) ~N


Again we fall into the things too rich for mutt category.

Idea: how about:

an eval which ran a mutt string, eg:
eval `cmd-to-make-the-above-color-command`

BTW, to make an OR like the above one of my shell scripts goes:

ptn=`echo $* | tr ' ' '|'`
egrep ($ptn) ...

i.e. echo the words, turn space into '|', put in () and use.
-- 
Cameron Simpson, DoD#743[EMAIL PROTECTED]http://www.zip.com.au/~cs/

My housemates have a Dumbfucks Killed by Avalanche thermometer next
to the television. They're hoping for 30 this winter, and nothing seems
to get them a-smilin' more than watching the 10:00 news and grabbing
that red magic marker.  - Dan Hillman



Re: coloring ~N by way of external file query?

2002-01-31 Thread Brian Clark

* Cameron Simpson ([EMAIL PROTECTED]) [Feb 01. 2002 00:04]:

 On 23:54 31 Jan 2002, Brian Clark [EMAIL PROTECTED] wrote:

 | IOW, I'm trying to replace these (a lot more than 3):
 | 
 | color index yellow default ~f feefee ~N
 | color index yellow default ~f geegee ~N
 | color index yellow default ~f heehee ~N
 | 
 | With one line that gets the list from a file (via grep?).

 A wrapper for mutt? Which generates a line like this:

   color index yellow default ~f (feefee|geegee|heehee) ~N

 Again we fall into the things too rich for mutt category.

Ack, yes, I do believe that would be going to far to keep me lazy. g
I guess I was just trying to save myself from having to add a few lines
each time I need to color that family. Plus, the .muttrc isn't as fit
as he used to be. I figured it was worth a shot.

Thanks for lending a hand.

-- 
Brian Clark | Avoiding the general public since 1805!
Fingerprint: 07CE FA37 8DF6 A109 8119 076B B5A2 E5FB E4D0 C7C8
I intend to live forever - so far, so good.




Re: coloring ~N by way of external file query?

2002-01-31 Thread David Champion

On 2002.01.31, in 20020201045411.GB18136@ganymede,
Brian Clark [EMAIL PROTECTED] wrote:
 
 IOW, I'm trying to replace these (a lot more than 3):
 
 color index yellow default ~f feefee ~N
 color index yellow default ~f geegee ~N
 color index yellow default ~f heehee ~N
 
 With one line that gets the list from a file (via grep?).

How about:

$ cat addrs.txt
feefee
geegee
heehee

$ cat dynacolor.sh
#!/bin/sh
awk '{printf(color index yellow default \~f %s ~N\\n, $1);}' addrs.txt

$ tail -1 .muttrc
source dynacolor.sh|

-- 
 -D.[EMAIL PROTECTED]NSITUniversity of Chicago



Re: coloring ~N by way of external file query?

2002-01-31 Thread Brian Clark

* David Champion ([EMAIL PROTECTED]) [Feb 01. 2002 00:20]:

[...]

  With one line that gets the list from a file (via grep?).

 How about:

 $ cat addrs.txt
 feefee
 geegee
 heehee

 $ cat dynacolor.sh
 #!/bin/sh
 awk '{printf(color index yellow default \~f %s ~N\\n, $1);}' addrs.txt

 $ tail -1 .muttrc
 source dynacolor.sh|

El neato. That's super! I had to wrap %s in escaped double quotes, but
exactly what I'm looking for. And I guess I've learned about `source'
now. *Sigh*

(the sig fits!)
-- 
Brian Clark | Avoiding the general public since 1805!
Fingerprint: 07CE FA37 8DF6 A109 8119 076B B5A2 E5FB E4D0 C7C8
I have learned to use the word 'impossible' with the greatest caution.




Re: coloring ~N by way of external file query?

2002-01-31 Thread Brian Clark

* Brian Clark ([EMAIL PROTECTED]) [Feb 01. 2002 00:33]:

  $ cat dynacolor.sh
  #!/bin/sh
  awk '{printf(color index yellow default \~f %s ~N\\n, $1);}' addrs.txt

By the way, if anyone else wants to do this and the lines in addrs.txt
have spaces, use $0 rather than $1.

awk '{printf(color index yellow default \~f \\\%s\\\ ~N\\n, $0);}'  addrs.txt

Thank, David. Neat trick.

-- 
Brian Clark | Avoiding the general public since 1805!
Fingerprint: 07CE FA37 8DF6 A109 8119 076B B5A2 E5FB E4D0 C7C8
It's never too late to panic.