Reading from a file(passing the file as input parameter)


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Reading from a file(passing the file as input parameter)
# 1  
Old 10-19-2009
Reading from a file(passing the file as input parameter)

hi
I have a shell script say primary.sh . There is a file called params
my scenario is
primary.sh should read all the values and echo it
for example
i should pass like
$primary.sh params
output would be
Abc
bpe
crv
fett
All the above values are from the file params
That is primary.sh should read all the values from the file params and echo it .Till it is exhausted

Thanks in advance
# 2  
Old 10-19-2009
Now that we know what needs to be done, where exactly are you stuck? What seems to be the problem?
You've had over 40 posts to this forum. What have you tried so far?
# 3  
Old 10-19-2009
how will i read line by line and how will i know that the number of lines have exhausted

---------- Post updated at 09:48 AM ---------- Previous update was at 09:38 AM ----------

ok i myself got it
while read linevar
do
print $linevar
done < a.txt

---------- Post updated at 09:49 AM ---------- Previous update was at 09:48 AM ----------

ok i myself got it
while read linevar
do
print $linevar
done < a.txt[/quote]
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace multiple file by passing parameter value

Hello All, I want to change date part in file name to yesterday date in the file name. example file name file-12122017-06-30-41.dat want file-12112017-06-30-41.dat I am doing like below. Below it is not changing the filename. Actually it is not parsing the $today and $yesterday value in... (1 Reply)
Discussion started by: looney
1 Replies

2. Shell Programming and Scripting

Passing parameter through file

Hi , I am passing date parameter through file my shell script testing.sh is #set -x #set -v asd=$1 asd1=$2 echo $asd echo $asd1 Passing parameter as below sh testing.sh `cat file1.txt` Output (2 Replies)
Discussion started by: kaushik02018
2 Replies

3. Shell Programming and Scripting

Passing file content as parameter

Hi All, I am passing a file value as parameter to awk command; Par.txt A|B Input.txt A,1 B,3 C,4 D,5 My desired output should be A,1 B,3 (4 Replies)
Discussion started by: kmsekhar
4 Replies

4. Shell Programming and Scripting

Passing string as a input parameter for a shell script

Hi i have a shell script which needs a string as an input parameter. How to pass the string param as an input? In command line am running the script. for e.g., a="who is a buddy?" sh sample.sh $a Inside the script i get this input param as $1 but only the value "who" is accepted... (12 Replies)
Discussion started by: vidhyaS
12 Replies

5. Shell Programming and Scripting

AT command parameter passing to php file

I have a bash script which utilizes a random function and then runs a file at now plus a random time. The problem is, that the php file requires a parameter after it eg: phpfile.php?code=123245b3 When i put in the file including the full path, with the at command, it will run, but not with... (1 Reply)
Discussion started by: thruxmore
1 Replies

6. Shell Programming and Scripting

Reading specific contents from 1 input files and appending it to another input file

Hi guys, I am new to AWK and unix scripting. Please see below my problem and let me know if anyone you can help. I have 2 input files (example given below) Input file 2 is a standard file (it will not change) and we have to get the name (second column after comma) from it and append it... (5 Replies)
Discussion started by: sksahu
5 Replies

7. Shell Programming and Scripting

Passing parameter from one file to shell script

Hi All, I have a 2 files. File1 i am generating using an ETL tool, which is a comman seperated delimited file which contains country code & load date. everytime, this country code will be updated from a table. It might be AB or BA & ld_date will be for which date we need to load the file. ... (7 Replies)
Discussion started by: Amit.Sagpariya
7 Replies

8. Shell Programming and Scripting

Reading a Parameter File

Hi, I need to read the parameters from a file and assign them to Global variables. I need to read a specific parameter value every time and pass it to the other script. Suppose i have a parameter file like PARAM.txt PAR1= VAL1 PAR2= VAL2 PAR3= VAL3 I want to read PAR2 file and in the... (1 Reply)
Discussion started by: Raamc
1 Replies

9. Solaris

passing an input parameter like date thru jcl using BPXBATCH utility

Hi.... i need to pass the dates (from - to) as the input parameters thru jcl invoking BPXBATCH utility. I know that PARM will do the above functionality. But how the above dates passed through jcl will be linked in the java-db2 program to be used in sql queries in order to generate the report... (0 Replies)
Discussion started by: Sujatha Gowda
0 Replies

10. Shell Programming and Scripting

reading the parameter from another file

I have a script where 3 parametrs are passed to it and it creates the file for each site form a template. If i want to get the 3rd parameter (which is the site) passed to the script to come from another file how I can change the script tp acheive it? Here is my script: what i have in the... (15 Replies)
Discussion started by: dsravan
15 Replies
Login or Register to Ask a Question