# Parse config file data to script variable

**URL:** <https://community.unix.com/t/parse-config-file-data-to-script-variable/273924>\
**Category:** Shell Programming and Scripting\
**Created:** [September 23, 2010, 3:29am UTC](https://community.unix.com/t/parse-config-file-data-to-script-variable/273924 "2010-09-23T03:29:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![souryadipta](https://community.unix.com/letter_avatar/souryadipta/32/6_449c533f586939b6e5f246632a46421f.png) [@souryadipta](https://community.unix.com/u/souryadipta)\
**Post date:** [September 23, 2010, 3:29am UTC](https://community.unix.com/t/parse-config-file-data-to-script-variable/273924/1 "2010-09-23T03:29:55Z")

</div>

I have a script with few pre defined variables.

Also have a config file. Something like this.  
# config file

# Define Oracle User  
MOD1\_TAG=abcde  
MOD2\_TAG=xyzabc  
MOD3\_TAG=def

I need to parse the config file and have each of the value copied to different variables.  
Please suggest what to do in script.

eg : copying abcde to $BUILDPATH

---

<div class="post-metadata">

**Author:** ![Franklin52](https://community.unix.com/user_avatar/community.unix.com/franklin52/32/500_2.png) [@Franklin52](https://community.unix.com/u/Franklin52)\
**Post date:** [September 23, 2010, 3:51am UTC](https://community.unix.com/t/parse-config-file-data-to-script-variable/273924/2 "2010-09-23T03:51:56Z")

</div>

You can do something like this in your script:

```nohighlight
BUILDPATH=$(awk -F"=" '/MOD1_TAG/{print $2}' config file)

```
