reading data from .ini file

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting reading data from .ini file
# 1  
Old 05-28-2008
reading data from .ini file


I have a sample data file that contains name-value pairs in it.

For example:

My concern is
1. How to get values of name1, name2, name3 using korn shell script?
2. I don't want to access each varible using $name1,$name2, $name3 but something in the form a list so that when i use for loop i can retrive those values.

Thanks for you help.
# 2  
Old 05-28-2008
try this

HTML Code:
for  var1 in `cut -f 2 -d "="  datafile.ini `
   echo $var1
   # put any commands here 
   # to manipulate the variable

# 3  
Old 06-02-2008
Thanks the code is executing fine according to my needs.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Reading data from file using awk

I have a file as below. It contains two data sets separated by >. I want to pipe each data set to another program called psxy. How can I get the different records Have started doing as follows but it only passes the first data set awk 'BEGIN {RS=">"};{print $0}' p.dat cat p.dat... (12 Replies)
Discussion started by: kristinu
12 Replies

2. Shell Programming and Scripting

reading data from a file to an array

I need some help with this code below, i doesnt know why it will run twice with my function, but my function only got if else, any other way that can read line and put into array? while read line; do read -A array <<<$line n=${#array} for ((i=1;i<$n;i++)); do print... (1 Reply)
Discussion started by: gavin_L
1 Replies

3. Shell Programming and Scripting

Reading XML data in a FLAT FILE

I have a requirement to read the xml file and split the files into two diffrent files in Unix shell script. Could anyone please help me out with this requirement. Sample file --------------- 0,<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Information... (3 Replies)
Discussion started by: kmanivan82
3 Replies

4. Shell Programming and Scripting

Reading and analysing data in a text file

Hi, I have below type of data in a text file in unix. Emp_Name Emp_Dept Raj 101 Amruta 100 Shilpa 100 Rohit 123 Amol 198 Rosh 101 Gaurav 198 Number of employees can be even more. Need a command or a... (2 Replies)
Discussion started by: rajneesh_kapoor
2 Replies

5. Shell Programming and Scripting

Perl: Reading data from other file

Hi, I am writting some perl scripts for daily backup process. In which I want to pass some data/referance from another txt file. Text file contains only one column and multiple rows. I want to pass this data to variables of another perl script. e.g. Refdoc.txt file contains data as: perl1... (3 Replies)
Discussion started by: n.dba
3 Replies

6. Shell Programming and Scripting

Reading data from file and assigning to variable

I was trying to store the number of lines in a file and store it in a file.after that i want to store the information in a file to a variable which is further used in the if loop to check certain condition. #!/bin/bash cat <file> | wc -l > count.txt x="$count.txt"; i=10; if ; then cat... (10 Replies)
Discussion started by: sudhakaryadav
10 Replies

7. Shell Programming and Scripting

Reading data from DataBase and Writing to a file

Hi All, Please help me in writing data to a file in one row. In database there is a column which contains large data which does not fit in the file in one row. The column contains list of paths. I want to write these paths to a file in one row. Please find the code below writes : ... (2 Replies)
Discussion started by: rajeshorpu
2 Replies

8. Shell Programming and Scripting

Reading data from a file through shell script

There is one Text file data.txt. Data within this file looks like: a.sql b.sql c.sql d.sql ..... ..... want to write a shell script which will access these values within a loop, access one value at a time and store into a variable. can anyone plz help me. (2 Replies)
Discussion started by: Dip
2 Replies

9. Shell Programming and Scripting

Using loop reading a file,retrieving data from data base.

Hi All, I am having trouble through, I am reading the input from tab delimited file containing several records, e.g. line1 field1 field2 field3 so on.. line2 field1 field2 field3 so on.. .. .. on the basis of certain fields for each record in input file, I have to retrieve... (1 Reply)
Discussion started by: Sonu4lov
1 Replies
Login or Register to Ask a Question

Featured Tech Videos