06-26-2006
How to send filename as variable in a shell script
Can we can pass the filename as variable in the shell script.
Sending the filename as a parameter file, the shell script takes the filename, needs to replace the string containing the filename with the variable in the shell script.
EX: test1.sh is the shell script and takes file1.csv as parameter file. Then file1.csv has to be replaced in the test1.ctl file where the control file contains the infile option taking as test1.csv
From the command line execute
test1.sh file1.csv
#Take the file1.csv file and replace it in test1.ctl
#test1.ctl
load data
infile 'testing.csv'
......
......
Here the testing.csv has to be replaced by 'test1.csv' in the test1.ctl file. Hope the scenario is clear and any solution is greatly appreciated. Thanks.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Forgive me if this is a trivial question, but I haven't been able to find the answer to this.
Basically I've got a list of files in a particular directory that have the general form t_*.dat. (I have other files in the same directory as well).
Essentially what I want to do is obtain the name... (1 Reply)
Discussion started by: lost.identity
1 Replies
2. Shell Programming and Scripting
I am having some trouble with a shell script I am writing. In the program I pass the path of where certain file names exist. I then want to loop through each file name and pass it as a DATA variable when calling sqlldr for a control file. This is what I have:
ls $FILEPATH/${FILENAME}*.csv
... (4 Replies)
Discussion started by: neva
4 Replies
3. UNIX for Dummies Questions & Answers
Hi ,
How to send e-mail from shell script ( C shell ) . Mailx command is not working ( It didn't giving error also ). Please help me (2 Replies)
Discussion started by: arukuku
2 Replies
4. Shell Programming and Scripting
Hi Friends,
The below shell script is written by third party to create B2k_session_id.iam trying to execute this script.When i execute below script it is calling some other scripts.How to find which scripts is calling?
. `execom commfunc.com`
echo " $PRESENTATION_MODE "
if
then
echo... (1 Reply)
Discussion started by: vadlamudy
1 Replies
5. Shell Programming and Scripting
HI,
MY question is a very simple one:
if i want to call an awk script with the input file name and also pass a variable value , then how to do it.
#>awk -f my_script.awk -v variable=value my_inputfile.txt
I can't do it like this.
throws error:
awk: my_script.awk:18:... (0 Replies)
Discussion started by: Onkar Banerjee
0 Replies
6. Shell Programming and Scripting
Hi
Please describe about following condition
if ]
in shell script.
Also please provide the link related all the flags which are applicable for if condition in Shell (4 Replies)
Discussion started by: munna_dude
4 Replies
7. Shell Programming and Scripting
HI
owner date and time and size of file in a row
shell script to list filename file_path i have tried the below code
present_dir=`pwd`
dir=`dirname $0`
list=`ls -lrt | awk {'print $9,$3,$6,$7,$8'}`
size=`du -h`
path=`cd $dir;pwd;`
printf "$list"
printf "$path"
printf " $size"
... (4 Replies)
Discussion started by: abiram
4 Replies
8. Shell Programming and Scripting
originally the shellscript
#ln_file_name=`echo $ld_interface_date"_"${8}".csv"`
#ln_file_name=`echo 201202011527_HL_HLTM1_B04A.csv`
ln_file_name="*"`echo ${7}".csv"`
get_file_list_1=$log_path"tm1_file_list.gfl1"
cd ${source_path}
echo "Try to find any file exist in the... (10 Replies)
Discussion started by: feilhk
10 Replies
9. Shell Programming and Scripting
Hi
I want to fetch the latest file form the list
example
example= filename RATE_STATE_SETUPS.20151222.ccyymmdd.hhmmss.txt
File pick which have latest ccyymmdd.hhmmss
list of file in directory are
RATE_STATE_SETUPS.20151222.20151222.170101.txt... (5 Replies)
Discussion started by: MOHANP12
5 Replies
10. Shell Programming and Scripting
Hi Guys,
I am very new to shell script and I need your help here to write a script. Actually, I have a script abc.sh which don't get terminated itself. So I need to design a script to run this script, save the output to a file, search for a given string in the output and if it exists send those... (11 Replies)
Discussion started by: Sambit Sahu
11 Replies