| Author |
shell substitution
|
|
| rickm@galaxy.nsc.com 2007-12-19, 7:27 pm |
| 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
| |
| Lew Pitcher 2007-12-19, 7:27 pm |
| 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
| |
| Bill Marcum 2007-12-19, 7:27 pm |
| On 2007-12-19, Lew Pitcher <lpitcher@teksavvy.com> wrote:
>
>
> On Dec 19, 2:51 pm, ri...@galaxy.nsc.com wrote:
>
> I need to subtitute $FILENAME
>
>
sed "s|FILENAME|$FILENAME|g" file > newfile
| |
| Michael Tosch 2007-12-20, 7:35 am |
| 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
|
|
|
|