Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: awk and ksh question

Re: awk and ksh question

From: Robert Eskridge <bryny_at_dfweahs.net>
Date: Mon, 03 Feb 2003 15:48:53 -0800
Message-ID: <F001.005428D2.20030203154853@fatcity.com>


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> 9991234567_at_pageme.com    # Lisa pager 
K> lisa.koivu_at_efairfield.com        # 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: bryny_at_dfweahs.net

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: ListGuru_at_fatcity.com (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). Received on Mon Feb 03 2003 - 17:48:53 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US