shell substitution
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
Re: shell substitution
On Dec 19, 2:51 pm, ri... [at] galaxy.nsc.com 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
I need to subtitute $FILENAME
> end result:
>
> I need to subtitue path/to/myfile.txt
>
> Thanks
Re: shell substitution
On 2007-12-19, Lew Pitcher <lpitcher [at] teksavvy.com> wrote:
>
>
> On Dec 19, 2:51 pm, ri... [at] galaxy.nsc.com 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
>
> I need to subtitute $FILENAME
>
>> end result:
>>
>> I need to subtitue path/to/myfile.txt
>>
>> Thanks
>
sed "s|FILENAME|$FILENAME|g" file > newfile
Re: shell substitution
rickm [at] galaxy.nsc.com 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
sed "s#FILENAME#$FILENAME#" file
awk '{sub("FILENAME",f);print}' f=$FILENAME file
--
Michael Tosch [at] hp : com