Lisa,
Awk and sh are competing for the interpretation of $1. I messed
around trying to get the replacement not to happen but didn't have
much luck.
Awk is overkill for this anyway. How about:
export FILE=$1
print File is $FILE
for PAGER in `grep -v "^#" $FILE | cut -d" " -f1`
do
print $PAGER
done
-rje
K> Hello everyone,
K> I'm trying to awk through a text file and use that with a passed-in message
K> to send email. Here's an example of my text file:
K> # DBA's on call
K> [EMAIL PROTECTED] # Lisa pager
K> [EMAIL PROTECTED] # Lisa email
K> Here's my awk statement, which works properly
K> awk '!/^#/ {print $1}' filename.txt
K> prints the first entry in each file and skips any lines starting with #.
K> So I put it in a loop. I don't quite understand all the syntax here, I'm
K> pulling the exact syntax out of Steve Adams' database check script.
K> --
K> for PAGER in ${*-$(awk '!/^#/ {print $1}' dba_oncall.txt)}
K> do
K> print $PAGER
K> done
K> --
K> Works fine.
K> Now when I try to pass in a parameter in $1 (which I mean to be the email
K> message), awk grabs it and the script no longer works. Like this
K> --
K> export FILE=$1
K> print File is $FILE
K> for PAGER in ${*-$(awk '!/^#/ {print $1}' dba_oncall.txt)};
K> do
K> print $PAGER
K> done
-rje
--
Please see the official ORACLE-L FAQ: http://www.orafaq.net
--
Author: Robert Eskridge
INET: [EMAIL PROTECTED]
Fat City Network Services -- 858-538-5051 http://www.fatcity.com
San Diego, California -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).