Below i have the following `SES.ses` file:

```
1 VERSION_CONTROL {
2    FILE_NAME = "C:/Users/kjbaili/Documents/SWCD_TEST/SES.ses";
3    DATE = "";
4    VERSION = "1.1";
5    AUTHOR = "";
6  }
7
8  DISPLAYS {
9    DISPLAY xxx-c-vm-0120:main = {
10        COMPUTER = "xxx-C-VM-0120";
11        DISPLAY = "main";
12        ITEMS {
13            PANEL  {
14                name = "visu.pnl";
15            }
16        }
17    }
18   }
19
20   RT-HOSTS {
21    RT-HOST xxx-c-vm-0120 = {
22        COMPONENT  {
23            name = "RTE_connections_xxxxx.cmp";
24        }
25        COMPONENT  {
26            name = "xxxx.cmp";
27        }
28    }
29    RT-HOST xxx-c-agx-0003 = {
30        COMPONENT  {
31            name = "CtApxxx.cmp";
32        }
33        COMPONENT  {
34            name = "CtApxxx.cmp";
35        }
36        COMPONENT  {
37            name = "CtApxxx.cmp";
38        }
39    }
40   }
41
42   HARDWARE {
43    } 

```

The user enters three Inputs to be placed in lines `2`, `9`, `21` and `29` -> `/userpath`, `DISPLAY Node0`, `RT-HOSTS Node0`, and `RT-HOSTS Node1` accordingly.

I'm trying to edit variables in this file based on above user's input. These are : `FILE_NAME (line 2)`, `DISPLAY (line 9)`, `RT-HOSTS ( line 21 and 29)`

After doing some research i could build the following:

```
currentPath=$(pwd)/SES    

awk -v path="$currentPath" '/FILE_NAME/ {cnt++} /FILE_NAME/ && cnt==1 {lnee=gensub(/(^.*\")(.*)(\".*$)/,"\\1"path"\\3",$0);print lnee; next}1' SES.ses > SES.temp && mv -f SES.tmp SES.ses

```

This command supposes to find the first entry for `FILE_NAME` and set the variable `currentPath` to it. However i'm getting the following error:

```
    awk: cmd. line:1: warning: regexp escape sequence `\"' is not a known regexp operator
mv: cannot stat 'SES.tmp': No such file or directory

```

So my question is how to solve this error and how to set the other three variables `line 9, 21 and 29`

Thank in advance and would really appriciate your help

suggested solution from @Ed Morton:

```
    awk -v filename='foo' -v display='bar' -v rthosts='some others' 'BEGIN { numRth = split(rthosts,rths) }

(filename != "") && ($1 == "FILE_NAME") { newval=filename; filename="" }
(display != "")  && ($1 == "DISPLAY")   { newval=display;   display="" }
(numRth in rths) && ($1 == "RT-HOST")   { newval=rths[++c]; delete rths[c] }

newval != "" {
    oldval = ( $2 == "=" ? $3 : $2 )
    gsub(/^[^"]*"|"[^"]*$/,"",oldval)
    pos = index($0,oldval)
    $0 = substr($0,1,pos-1) newval substr($0,pos+length(oldval))
    newval = ""
}

{ print }' SES.ses

```

output of `cat -Ev SES.ses`

```
$
VERSION_CONTROL {$
    FILE_NAME = "/c/Users/kjbaili/Documents/DO_NOT_DELETE/SES";$
    DATE = "";$
    VERSION = "1.1";$
    AUTHOR = "";$
}$
$
DISPLAYS {$
    DISPLAY d = {$
        COMPUTER = "FDT-C-VM-0120";$
        DISPLAY = "main";$
        ITEMS {$
            PANEL  {$
                name = "visu.pnl";$
            }$
        }$
    }$
}$
$
RT-HOSTS {$
    RT-HOST v = {$
        COMPONENT  {$
            name = "RTE_connections_CtCoFallbackPath.cmp";$
        }$
        COMPONENT  {$
            name = "CtGwHwpFbpCmp.cmp";$
        }$
    }$
    RT-HOST v = {$
        COMPONENT  {$
            name = "CtApHwpFbpSit.cmp";$
        }$
        COMPONENT  {$
            name = "CtApHwpFbpMpl.cmp";$
        }$
        COMPONENT  {$
            name = "CtApHwpFbpCVGen.cmp";$
        }$
    }$
}$
$
HARDWARE {$
}$

```