by Ed Morton <morton@[EMAIL PROTECTED]
>
Dec 19, 2007 at 11:09 PM
On 12/19/2007 1:50 PM, rickm@[EMAIL PROTECTED]
wrote:
> There has been a number of old threads on this but non looked like
> they worked
>
> I have a shell env varible and a file that has a generic name. The
> resolved shell var needs to be substituted in that spot:
>
> setenv FILENAME /path/to/myfile.txt
>
> the file has some text:
>
> I need to subtitue FILENAME
>
> end result:
>
> I need to subtitue path/to/myfile.txt
>
> Thanks
awk -v filename="$FILENAME" 'BEGIN{sub(/\//,"",filename)}
sub(FILENAME,filename)1' file
Ed.