On 2004.12.15 10:10 Roger Barnes wrote:
I'm trying to think of a way that doesn't use an intermediate file,
not that it would be any more efficient given the whole file will be
re-written no matter what you do.  I tried using less with unlimited
memory buffers (-b-1) instead of cat, but it doesn't work any better,
probably because of how pipes work.

Will this do:

#!/bin/bash

STATIC_FILE=`/bin/cat << "EOF"
jumps over
the lazy dog
down by the
river side.
EOF`

BASH_VAR_1="The quick"
BASH_VAR_2="brown fox"

echo "$STATIC_FILE" |
/bin/gawk -v i="$BASH_VAR_1" -v j="$BASH_VAR_2" 'BEGIN {
    print i
    print j
    }
    {
    print ($0)
    }'


Cheers, Robert Thorsby -- 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