Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] shell scripting help

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


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

You mean, like this?

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

If that's not it, could you give an example of the desired output?