shell substitution
am 19.12.2007 20:51:28 von RickM
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
am 19.12.2007 21:24:05 von Lew Pitcher
On Dec 19, 2:51 pm, ri...@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
am 19.12.2007 22:24:33 von Bill Marcum
On 2007-12-19, Lew Pitcher wrote:
>
>
> On Dec 19, 2:51 pm, ri...@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
am 20.12.2007 10:01:39 von Michael Tosch
rickm@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 @ hp : com