>>>>> "Aleksey" == Aleksey Tsalolikhin <[email protected]> writes:

Aleksey> On Fri, Sep 18, 2009 at 6:42 AM, Daniel Bush
Aleksey> <[email protected]> wrote:
>> Hi, Writing a little utility to help me on something but having
>> trouble.  Why does f stay blank?
>> 
>> d...@lin4:test$ echo "foo|bar" | awk 'BEGIN{RS="|"}{ print $1 }' |
>> while read s; do echo $s; f=$s; done; echo "'$f'" foo bar ''

Aleksey> and

>> The string being piped is an extended regular expression which I
>> wanted to prepend with a file path

Aleksey> You mean, like this?

Aleksey> # echo "foo|bar" | awk 'BEGIN{RS="|"}{ print "filepath/"$1 }'
Aleksey> filepath/foo filepath/bar #


Why not just use the shell.

x='foo|bah'
OIFS="$IFS"
IFS='|'
set $x
IFS="$OIFS"

for x
do
        f="$x"
done
echo "'$f'"

Peter C
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to