X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:reply-to:subject:references:to:from:message-id
	:date:mime-version:in-reply-to:content-type
	:content-transfer-encoding; q=dns; s=default; b=w761Ygiay4IsOo3A
	ySNjyoksjN2J5Bb5IRkZxsEvAQFs92bVyhWLB5q0ERS33orBhj7fWPR3VKOTWdE+
	KBt2sPvFUov75C8OoydXoadC78+akhzEu+lg1TI+V4EyorCNpxKbnyBAZF7U02SD
	KQ8F8e9bpTHQkJ52Mch0sNsTBWQ=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:reply-to:subject:references:to:from:message-id
	:date:mime-version:in-reply-to:content-type
	:content-transfer-encoding; s=default; bh=BIB77Pq7pmpO7XXi2LYLAq
	WBKmU=; b=mmDB2ccRpLeZ2LqzS6xp/DXAaJjukl8u9HJXyPfk8eq3h8t/BHxhxs
	7QngDRewwUpYPa3tZEhWsulKDr2Mwi2yfEwhO2eSPtelZjaaoISkG7slBR6OrDLm
	lrYfZkBR6YsssjNIBzdxOl50+yKSReI8wo/pcTFj0G+kEb7DyzESQ=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=no version=3.3.2
X-HELO: csmail.cs.umass.edu
Reply-To: moss@cs.umass.edu
Subject: Re: Awk not ouputting results via echo
References: <CAE3taFC=tjki1FTfbjyt+KnEGsWmrj63FMeBjgRswRwRSKdAWQ@mail.gmail.com>
To: cygwin@cygwin.com
From: Eliot Moss <moss@cs.umass.edu>
Message-ID: <56532F6A.3020906@cs.umass.edu>
Date: Mon, 23 Nov 2015 10:23:22 -0500
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0
MIME-Version: 1.0
In-Reply-To: <CAE3taFC=tjki1FTfbjyt+KnEGsWmrj63FMeBjgRswRwRSKdAWQ@mail.gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes

Ok, I think I have a sense of an underlying problem here.

When you do:  ... | read v1 v2 ...

The read executes in an inferior process, setting variables there.
The process then exits and you have no bindings in the parent shell,
which is where you want them.

Maybe something like this would suit you better:

myfunction() {
   ... stuff using positional arguments $1, $2, etc.
}

myfunction $(awk blah ...)

This take the output of the invocation of awk and puts it
where $(awk ...) was, which will invoke myfunction with
the line, parsing it into separate arguments (I believe).

You could also capture the line using something like this:

line="$(awk ...)"

and then you can fiddle the result however you want, but I think that
calling a function (or another script) is probably simpler here.

Regards -- Eliot Moss

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

