# reading data from .ini file

**URL:** <https://community.unix.com/t/reading-data-from-ini-file/198808>\
**Category:** Shell Programming and Scripting\
**Created:** [May 28, 2008, 3:49pm UTC](https://community.unix.com/t/reading-data-from-ini-file/198808 "2008-05-28T15:49:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vinna](https://community.unix.com/letter_avatar/vinna/32/6_449c533f586939b6e5f246632a46421f.png) [@vinna](https://community.unix.com/u/vinna)\
**Post date:** [May 28, 2008, 3:49pm UTC](https://community.unix.com/t/reading-data-from-ini-file/198808/1 "2008-05-28T15:49:42Z")

</div>

Hi,

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

For example:  
name1=value1  
name2=value2  
name3=value3  
...  
...  
...

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.

---

<div class="post-metadata">

**Author:** ![ironmask2004](https://community.unix.com/letter_avatar/ironmask2004/32/6_449c533f586939b6e5f246632a46421f.png) [@ironmask2004](https://community.unix.com/u/ironmask2004)\
**Post date:** [May 28, 2008, 4:51pm UTC](https://community.unix.com/t/reading-data-from-ini-file/198808/2 "2008-05-28T16:51:07Z")

</div>

try this

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

done

```

....

---

<div class="post-metadata">

**Author:** ![vinna](https://community.unix.com/letter_avatar/vinna/32/6_449c533f586939b6e5f246632a46421f.png) [@vinna](https://community.unix.com/u/vinna)\
**Post date:** [June 2, 2008, 11:44am UTC](https://community.unix.com/t/reading-data-from-ini-file/198808/3 "2008-06-02T11:44:51Z")

</div>

Thanks the code is executing fine according to my needs.
