Subsitution in file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Subsitution in file
# 1  
Old 10-13-2002
Subsitution in file

I am calling oracle from a shell script and basically retrieving a
line into a variable called command which contains a command which is like
rwrun60 userid=$DATABASE_USER par_start_date =$PAR_START_DATE .....
when I try to execute this command using `echo $command`
It does not subsitute the values of the various parameters
like $DATABASE_USER which are defined in the file.
Can anybody help me
Regards,
Saurabh
# 2  
Old 10-13-2002
Try:

exec $command

Smilie
# 3  
Old 10-14-2002
try:

echo -e "$variable"

or

printf "$variable\n"
# 4  
Old 10-15-2002
You can use this :

userid=${DATABASE_USER}
par_start_date =${PAR_START_DATE}


for more information : http://www.cs.princeton.edu/~jlk/kor...doc/man88.html

${parameter }
The shell reads all the characters from ${ to the matching } as part of the same word even if it contains braces or metacharacters. The value, if any, of the parameter is substituted. The braces are required when parameter is followed by a letter, digit, or underscore that is not to be interpreted as part of its name or when a variable is subscripted. If parameter is one or more digits then it is a positional parameter. A positional parameter of more than one digit must be enclosed in braces. If parameter is * or @, then all the positional parameters, starting with $1, are substituted (separated by a field separator character). If an array identifier with subscript * or @ is used, then the value for each of the elements is substituted (separated by a field separator character).



I hope help you

Witt
witt
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script (sh file) logic to compare contents of one file with another file and output to file

Shell script logic Hi I have 2 input files like with file 1 content as (file1) "BRGTEST-242" a.txt "BRGTEST-240" a.txt "BRGTEST-219" e.txt File 2 contents as fle(2) "BRGTEST-244" a.txt "BRGTEST-244" b.txt "BRGTEST-231" c.txt "BRGTEST-231" d.txt "BRGTEST-221" e.txt I want to get... (22 Replies)
Discussion started by: pottic
22 Replies

2. Shell Programming and Scripting

Compare 2 text file with 1 column in each file and write mismatch data to 3rd file

Hi, I need to compare 2 text files with around 60000 rows and 1 column. I need to compare these and write the mismatch data to 3rd file. File1 - file2 = file3 wc -l file1.txt 58112 wc -l file2.txt 55260 head -5 file1.txt 101214200123 101214700300 101250030067 101214100500... (10 Replies)
Discussion started by: Divya Nochiyil
10 Replies

3. Shell Programming and Scripting

Match list of strings in File A and compare with File B, C and write to a output file in CSV format

Hi Friends, I'm a great fan of this forum... it has helped me tone my skills in shell scripting. I have a challenge here, which I'm sure you guys would help me in achieving... File A has a list of job ids and I need to compare this with the File B (*.log) and File C (extend *.log) and copy... (6 Replies)
Discussion started by: asnandhakumar
6 Replies

4. Shell Programming and Scripting

awk search/replace specific field, using variables for regexp & subsitution then overwrite file

Hello, I'm trying the solve the following problem. I have a file which I intend to use as a csv called master.csv The columns are separated by commas. I want to change the text on a specific row in either column 3,4,5 or 6 from xxx to yyy depending upon if column 1 matches a specified pattern.... (3 Replies)
Discussion started by: cyphex
3 Replies

5. Shell Programming and Scripting

Sed subsitution on loop output in shell script

I have a forloop which checks a log for a set of 6 static IP addresses and each IP found is logged to a file which is then mailed to me. After the forloop I always have a text file that may contain up to 6 IP addresses or may contain 0. What I want to do is substitute the IP addresses (if any)... (2 Replies)
Discussion started by: Moxy
2 Replies

6. Shell Programming and Scripting

using the sed command with variable subsitution???

how much do you know on using the sed commands within a diff command? I'm currently using one long command when robot runs that... when the diff command is ran that the < and > signs at the beginning of each line are changed to the environment name that they came from... making it easier to... (2 Replies)
Discussion started by: anthreedhr
2 Replies
Login or Register to Ask a Question