Com o Notepad ++, você pode fazer:
- Ctrl + H
- Encontre o que:
^([^,]*,(\d\d)_[^,]*,[^,]*)(?<!_\d\d),
- Substituir por:
$1_$2,
- check Embrulhe
- verificar expressão regular
- Substituir todos
Explicação:
^ : beginning of line
( : start group 1
[^,]* : 0 or more non comma character
, : 1 comma
(\d\d) : group 2, 2 digits
_ : underscore
[^,]* : 0 or more non comma character
, : 1 comma
[^,]* : 0 or more non comma character
) : end group 1
(?<! : negative lookbehind, make sure we don't have before the comma
_\d\d : underscore and 2 digits
) : end lookbehind
, : a comma
Resultado para o exemplo dado:
col_A,16_9S0816YE556_GOPR0091_0S01,9S0815GP174_16,col_D
col_A,17_9S0816YE556_GOPR0091_1S01,9S0815GP174_17,col_D
col_A,18_9S0816YE556_GOPR0091_2S01,9S0815GP174_18,col_D
col_A,19_9S0816YE556_GOPR0091_3S01,9S0815GP174_19,col_D
col_A,01_9S0803SD006MN_C0001S01,9S0816GP175_01,col_D
col_A,02_9S0803SD006MN_C0002S01,9S0816GP175_02,col_D
col_A,03_9S0813ED095MN_8R7A3425S01,9S0816GP175_03,col_D
col_A,04_9S0813SD007MN_C0001S01,9S0816GP175_04,col_D