substituição de string com sed

0
        [Data_Foundation.WF:wf_STG_SIM_RKEM_RKEMMOVE]
    $Param_Object_Name=RKEMMOVE

            [Data_Foundation.WF:wf_STG_SIM_RKEM_RKEMEQBC]
    $Param_Object_Name=RKEMEQBC

            [Data_Foundation.WF:wf_STG_SIM_RKEM_RKEMEQCM]
    $Param_Object_Name=RKEMEQCM

            [Data_Foundation.WF:wf_STG_SIM_RKEM_RKEMLMOV]
    $Param_Object_Name=RKEMLMOV
sed -i 's/[Aa0-Zz9]*.WF:wf_STG_SIM_RKEM_RKEMEQBC/DEF.WF:wf_STG_SIM_RKEM_RKEMEQBC/g' param_file.parm

Padrões de nomes de pastas são Data_Foundation DataFoundation Data_Foundation12 DataFoundation12

string padrão [FOLDERNMAE.WF:$wf_name] Eu tenho que repalce foldername (datafoundatio por exemplo) com EFG (que é uma variável)     sed -i 's / [A-Za-z0-9] *. WF: wf_STG_SIM_RKEM_RKEMEQBC / EFG.WF: wf_STG_SIM_RKEM_RKEMEQBC / g' teste

quando eu uso o comando acima sed, estou ficando abaixo da saída

[Data_EFG.WF:wf_STG_SIM_RKEM_RKEMEQBC]

A saída real é [EFG.WF:wf_STG_SIM_RKEM_RKEMEQBC]

    
por user_297020 02.07.2018 / 09:32

1 resposta

0
$ cat test.txt
 [Data_Foundation.WF:wf_STG_SIM_RKEM_RKEMMOVE]
    $Param_Object_Name=RKEMMOVE

            [Data_Foundation.WF:wf_STG_SIM_RKEM_RKEMEQBC]
    $Param_Object_Name=RKEMEQBC

            [Data_Foundation.WF:wf_STG_SIM_RKEM_RKEMEQCM]
    $Param_Object_Name=RKEMEQCM

            [Data_Foundation.WF:wf_STG_SIM_RKEM_RKEMLMOV]
    $Param_Object_Name=RKEMLMOV
$
$ echo ${VAR}
EFG
$
$ sed "s/.*\(\.*WF.*$\)/\[$VAR./" test.txt
[EFG.WF:wf_STG_SIM_RKEM_RKEMMOVE]
    $Param_Object_Name=RKEMMOVE

[EFG.WF:wf_STG_SIM_RKEM_RKEMEQBC]
    $Param_Object_Name=RKEMEQBC

[EFG.WF:wf_STG_SIM_RKEM_RKEMEQCM]
    $Param_Object_Name=RKEMEQCM

[EFG.WF:wf_STG_SIM_RKEM_RKEMLMOV]
    $Param_Object_Name=RKEMLMOV
    
por 02.07.2018 / 11:21