Scripting help needed

Hi All,

I have a conf file and it has two entries seperated by comma, look like :-

best1,ls /opt/bmc/Patrol3/*/best1
......, .......................

In which "Best1" is the product name and "ls /opt/bmc/Patrol3/*/best1" is the way to find the product version of Best1 in that particular server.

Now what i need is to run the second part(ls /opt/bmc/Patrol3/*/best1) in the server and forward output with corresponding product name to a file. The output file should look like

Product_name Version
Best1 3.0.1
Loganame 1.0
..... ...
.... ...

Thanks,
Ren

I am not sure this is exactly what you want but here you go.

It creates a file name from the first column and execute the command from column two and redirect the input to the column one file name.

echo 'best1,ls /opt/bmc/Patrol3/*/best1' | awk -F , '{ system($2) > $1 }';
#/bin/ksh
echo "Product_name Version" > output_file
while read line
do
   f1=$(echo $line | cut -d"," -f1)
   f2=$($(echo $line | cut -d"," -f2))
   echo "$f1  $f2" >> output_file
done < config_file

Be careful about security here. A script like that would allow anyone with access to the datafile to have any command executed as the user who runs the script.

Thanks a lot for the help, I need some more modification to my output file.
Now it is look like ..

rtq1@sf00prd2 [/home/rtq1]
$ cat out.txt
Product_name
best1
Version
7.5.00
Product_name
logname_sec
Version
A10

But i want it like

Product_name      version
    best1                                                               7.5.00
    logname_sec                                                     A10

Please help me to modify my output file

Thanks in advance
Ren

Script in post #3 should work as you expecting.
If not, Please post the script/command you are running.