[Techtalk] Bash builtin "read" isn't working like I expect

Megan Golding mgolding at sdf.lonestar.org
Thu Oct 30 17:49:12 EST 2003


On Thu, Oct 30, 2003 at 05:07:31PM +0100, Dominik Schramm wrote:
> MAYBE... If $LINE contains "special" characters, this may
> be misinterpreted by the shell which parses the expressesions between
> do and done before executing them.
> E.g. if $LINE=="hey you" and $other-file="myfile" (without "")
> the resulting command is
>    grep hey you myfile
>
> "you" is interpreted as another file, and if it doesn't exist, grep exits.
>
> I'd use
>    grep "$LINE" $other-file

Great pointer, Dominik. I didn't even think of grep getting broken up with spaces in $LINE.

So, now I have:

while read LINE; do echo $LINE; grep "$LINE" master.csv; done < client.txt

Still no dice. For the record, client.txt has entries like this:

domain.com
bank.com
sample.org

(That is, the lines are domain names. The worst problem could be the "." in each domain name. No "@" signs. No spaces.)

I think we/I'm getting closer to a solution. Any other pointers?

Meg

-- 
Life with Rachel, one mom's journey: http://www.kalamitykat.com

AIM: meganau  Yahoo!: meggolding  email: mgolding at sdf.lonestar.org
SDF Public Access UNIX System - http://sdf.lonestar.org


More information about the Techtalk mailing list