Reading names with non-Latin characters and gender from a text file results in empty name

I’m practicing how to extract data from a text file and export it in columns for a csv file in ISE, and I’m confused as to why - what the title says - is happening. I am getting the data from Multinational list of popular first names and surnames?, specifically the archive link in the answer with 24 votes and the text file nam_dict but removed the text part that explains what it is and only leaving the gender, name, numbers, and $. Modified text file was too big to upload on Pastebin or here so file.io it is.

Example of what it looks like:

M  Aad                                  4                                             $
M  Aadam                                          1                                   $
F  Aadje                                1                                             $
M  Ådne                      +                 1                                      $
M  Aadu                                           12                                  $
?F Aaf                                  1                                             $
F  Aafke                                4                                             $
?  Aafke                                 1                                            $
F  Elv<i/>ra                                       4                                  $
M  <Z^>ydr<u/>nas                                   5                                 $
M  <Z^>ygantas                                      1                                 $
M  Zygfryd                                           1                                $
M  <Z^>ygimantas                                    2                                 $

I then feed this into ISE

Get-Content .\names_dict_master.txt | ForEach-Object {
    $sex = ($_ -split ' ' | Select-String -Pattern '^\?M$|^\?F$|^M$|^F$|\?$').Matches.Value
    $name = ($_ -split ' ' | Select-String -Pattern '\p{L}').Value -join ''
    [PSCustomObject]@{
        Sex = $sex
        Name = $name
    }
} | Export-Csv -Path .\names_dict_master_powershell.csv -Delimiter ',' -NoTypeInformation

and get (not completed file but that’s what it looks like)

"Sex","Name"
"M",""
"M",""
"F",""
"M",""
"M",""
"?F",""
"F",""
"?",""
"F",""
"M",""
"M",""

I don’t get why some of them return blank under the first column or just don’t match.

I’ve also tried .Matches.Value instead of -join '' on name and that didn’t work and returns mostly System.Object[]. and from reading Regular expression to match non-ASCII characters? on Stack Overflow, I know \p{L}, and \p{L}\p{M}*+ and /[\p{L}-]+/ug are options, I tried the first one, and that’s the result in the Pastebin file, the second one gave me an error:

At line:3 char:30
+ ... name = ($_ -split ' ' | Select-String -Pattern '\p{L}\p{M}*+') -join  ...
+                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Select-String], ArgumentException
    + FullyQualifiedErrorId : InvalidRegex,Microsoft.PowerShell.Commands.SelectStringCommand

and the third from Regular expression to match non-ASCII characters? gives me the same result as the first one. Keeping the names how they originally look would be ideal, probably going to have to add characters to the regex like <>. It would make sense why some characters would be excluded like <Z^>ydr<u/>nas but instead everything is excluded.

Thank you to anyone who replies, I’m pretty sure I’m making the columns correctly, I just have no clue why some values return and some don’t.

Xeryvelgarde,
Welcome to the forum. :wave:t3:

A few lines of the output posted directly and formatted as code would have been enough to show what you’re dealing with. :smirk:

On the other hand I miss a few lines of the input file you’re using. Or the code you’re using to create your input file. Without this there’s little to no chance for us to reproduce your issue. :man_shrugging:t3:

Please go back, edit your question once again and add these input data.

Thanks in advance.

Added links to the original file, modified file, and snippet of the input code, managed to be 2 links so the forum will allow me to post them. Will add nam_dict Reformat Incomplete - Pastebin.com here if there’s a need to look at the incomplete output in its entirety.

1 Like

Hmmm … 'not sure if that’s enough for you but it could be a starting point at least …

Using your sample data excerpt this would return the desired data I think:

Select-String -Path .\names_dict_master.txt -Pattern '^(?<SEX>\S+)\s+(?<Name>\S+)\s+'  |
Select-Object -ExpandProperty Matches |
ForEach-Object {
    [PSCustomObject]@{
        Sex  = ($_.Groups | Where-Object Name -EQ Sex).Value
        Name = ($_.Groups | Where-Object Name -EQ Name).Value
    }
}

The output looks like this:

Name           Sex
----           ---
Aad            M
Aadam          M
Aadje          F
Ådne           M
Aadu           M
Aaf            ?F
Aafke          F
Aafke          ?
Elv<i/>ra      F
<Z^>ydr<u/>nas M
<Z^>ygantas    M
Zygfryd        M
<Z^>ygimantas  M

Let me try that when I can this afternoon, thank you for your help so far, I appreciate it. Will update this post. Nevermind, just replied.

image
Using regex101, I think I understand how your pattern works and the commandlet, however when I try it, even with the small portion of the text file I sent you, it returns:

"Sex","Name"
"M","Aad"
"M","Aadam"
"F","Aadje"
"M","?dne"
"M","Aadu"
"?F","Aaf"
"F","Aafke"
"?","Aafke"
"F","Elv<i/>ra"
"M","<Z^>ydr<u/>nas"
"M","<Z^>ygantas"
"M","Zygfryd"
"M","<Z^>ygimantas"

So I think the  character’s gone, do you know why that is? The thing is my system allows reading characters like â, ê, ô, etc. so I don’t know if it’s that or something else on my system. I’ve tested it on the original text file I have too, and it doesn’t return lines like these:

F  Kathy                      246     4     2                                         $
F  Käthy                     -              4                                         $
=  Kathy Katherine            211                                                     $
=  Kathy Kathleen             311                                                     $

I get why Kathy Katherine/Kathy Kathleen wouldn’t return due to having a whitespace, which I think I can modify on my own, I think. Again, that was my bad because I legitimately didn’t notice there were names like that in the original text file. Oh, I think non Latin characters are all gone and replaced by ? Thank you for your help so far, I appreciate it.

You can actually share your “test environment” you used on regex101. :wink: … no need to post images of code what’s always a bad idea.

Sorry if that sound picky but that’s not the output my code suggestion outputs. It looks like the CSV representation. Let’s be specific and precise when it’s about code and data. :point_up_2:t3: :wink:

I only used the small excerpt of data you posted. But as you can see in the output my code suggestion produces the special character is still there. If you have problems saving them to a file with Export-Csv you should use the proper encoding to save your files. Most of the time -Encoding UTF8 solves those issues.

I’d recommend to chosse a small but still representative excerpt of the data you’re working with next time and describe as specific as possible what you want to do with it. Often it is even helpful to post an example of the expected output fitting to the input data you posted. :wink:

I’d recommend to save the input data with UTF8 encoding in the first place. That’s what I did. And then there might be more sophisticated regex patterns but the output looks quite promissing to me. :man_shrugging:t3:

Input data excerpt:

M  Aad                                  4                                             $
M  Aadam                                          1                                   $
F  Aadje                                1                                             $
M  Ådne                      +                 1                                      $
M  Aadu                                           12                                  $
?F Aaf                                  1                                             $
F  Aafke                                4                                             $
?  Aafke                                 1                                            $
M  Åge                       +                56                                      $
F  Aagje                              1 2                                             $
F  Aagot                                       1                                      $
F  Ågot                      +                 2                                      $
F  Aagoth                                      1                                      $
F  Ågoth                     +                 1                                      $
M  Åke                       +                118                                     $
M  Aalbert                              1                                             $
M  Aarón                            1                                                 $
M  Aarre                                         4                                    $
M  Aarron                     1                                                       $
F  Åsa                       +                118                                     $
F  Aase                                       661                                     $
F  Åse                       +                553                                     $
M  Åsgeir                    +                 1                                      $
F  Aashild                                     1                                      $
F  Åshild                    +                 2                                      $
F  Åslaug                    +                 1                                      $
M  Åsmund                    +                 2                                      $
F  Åste                      +                 1                                      $
M  Aat                                  1                                             $
M  Abdallah                                                                  6        $
M  Abdal+Salam                                                               1        $
M  Abdel                                                                   2 6        $
M  Abdel+Aziz                                                                5        $
M  Abdel+Fattah                                                              2        $
M  Abdel+Ghani                                                               2        $
M  Abder+Razak                                                               3        $
M  Abdeslam                                                                  3        $
M  Abdu                                                                      4        $
M  Abdülhalim                +                                              2         $
M  Abdülhamid                +                                              1         $
M  Abdülkadir                +                                              3         $
M  Abdülkerim                +                                              1         $
M  Abdülsamet                -                                              1         $
M  Abdul+Sattar                                                              1        $
M  Abdur+Rahman                                                              3        $
M  Abdyl                                                     2    4                   $
M  Abe                          1       2                                             $
=  Abe Abraham                  1                                                     $
M  Abed                                                                      4        $
F  Abeda                                                                     2        $
M  Afzal                                                                     3        $
F  Aga                                               1                                $
=  Aga Agnieszka                                     1                                $
F  Agaat                                1                                             $
F  Agetina                                                        2                   $
M  Agge                                  1                                            $
M  Aggeo                         1                                                    $
F  Aggie                      1                                                       $
M  Cimdins                                         1                                  $
F  Çimen                                                                    3         $
F  Cina                          1                                                    $
M  Ç<i>nar                                                                  3         $
F  Cinda                        1       1                                             $
F  Cindi                        1                                                     $
F  Cindie                       1                                                     $
F  Cindij                               1                                             $
F  Cindy                      226    565622 3                                         $
M  Ciríaco                         1                                                  $
M  Ciril                                                         5                    $
M  <C´>iril                                                 2                         $
F  Cirila                                                        1                    $
M  Cirillo                       1                                                    $
M  <C´>irilo                                               1                          $
F  Cirina                        1                                                    $
?M Clair                      2                                                       $
F  Claire                     684 6  7663   6                                         $
?F Clare                        2                                                     $
F  Cläre                     -            11                                          $
M  Clarence                   3 5                                                     $
F  Claretta                      1                                                    $
M  Clariano                        1                                                  $
F  Clarita                       1                                                    $
F  Clari<t,>a                                            2                            $
M  Clark                      1 3                                                     $
M  Cleveland                    2                                                     $
M  Cliff                      1 2                                                     $
=  Cliff Clifford               1                                                     $
M  Clifford                   5 5                                                     $
F  Clíodhna                    3                                                      $
F  Clíona                      5                                                      $
M  Clirim                                                         3                   $
F  Clita                         1                                                    $
F  Kayoko                                                                        7    $
M  Kays                                                                      4        $
M  Kazbek                                                                2 2          $
F  Kaz<e°>                                          2                                 $
M  Kazem                                                                     2        $
M  Kazi                                                                      3        $
=  Kazik Kazimierz                                   1                                $
M  Kazim                                                                     2        $
M  Kaz<i>m                                                                  5         $
F  Kazimiera                                        65                                $
M  Ka<z^>imir                                               3                         $
M  Kazimír                                             1                              $
M  Kázmér                                               2                             $
M  Kazuaki                                                                       5    $
M  Kazuhiro                                                                      6    $
M  Tešo                      -                                  1                     $
F  Tess                       1 1       1                                             $
F  Tessa                      2 2     2 41                               1            $
M  Tesse                                1                                             $
?  Yi+Ming                                                                     4      $
?  Yin                                                                         6      $
?  Ying+Bin                                                                    1      $
?  Ying+Bing                                                                   1      $
?  Ying+Da                                                                     1      $
?  Ying+Di                                                                     1      $
?  Ying+Fu                                                                     1      $
?  Ying+Gang                                                                   1      $
?  Zhi+Quan                                                                    3      $
?  Zhi+Sheng                                                                   1      $
?  Zhi+Shun                                                                    2      $
?  Zhi+Song                                                                    1      $
F  Zhivka                                                 7                           $
M  Zhivko                                                 7                           $
?  Zhi+Wang                                                                    1      $
?  Zhi+Wei                                                                     4      $
?  Zhi+Wen                                                                     3      $
?  Zhi+Wu                                                                      1      $
?  Zhi+Xia                                                                     1      $
?  Zhi+Xian                                                                    2      $
?  Zhi+Xiang                                                                   3      $
?  Zhong+Lin                                                                   2      $
?  Zhong+Ling                                                                  1      $
?  Zhong+Long                                                                  1      $
F  Zhoresa                                                2                           $
M  Zhoro                                                  3                           $
M  Zhorzh                                                 1                           $
F  Zhorzheta                                              1                           $
?  Zhou                                                                        4      $
?  Zhou+Hong                                                                   1      $
?  Zhou+Ping                                                                   1      $
?  Zhu                                                                         4      $
?  Zhu+An                                                                      1      $
?  Zhuang                                                                      2      $
?  Zhuang+Zhi                                                                  1      $
?  Zhu+Chuan                                                                   1      $
?  Zhu+Gang                                                                    1      $
?  Zhu+Guo                                                                     1      $
?  Zhu+Hong                                                                    1      $
?  Zhu+Jin                                                                     1      $
?  Zhu+Jun                                                                     1      $
?  Zhuo+Xi                                                                     1      $
?  Zhuo+Xuan                                                                   1      $
?  Zhu+Ping                                                                    1      $
?  Zhu+Qin                                                                     1      $
?  Zhu+Qing                                                                    2      $
?  Zhu+Xian                                                                    1      $
?  Zhu+Ying                                                                    2      $
?  Zhu+Yu                                                                      1      $
?  Zi                                                                          3      $
M  Zia                                                                       2        $
?  Zi+Kun                                                                      1      $
F  Zila                                                                       1       $
?  Zi+Lai                                                                      2      $
F  Zilha                                                   5   1                      $
?  Zi+Li                                                                       3      $
F  Zília                                                1                             $
?  Zi+Liang                                                                    1      $
?  Zi+Ling                                                                     1      $
F  Zilli                                  11                                          $
?  Zi+Long                                                                     1      $
?  Zi+Lu                                                                       1      $
M  <Z^>ilvinas                                      5                                 $
?  Zi+Mei                                                                      1      $
?  Zi+Mian                                                                     1      $
?  Zi+Min                                                                      1      $
?  Zi+Ming                                                                     2      $
F  Zina                         11                  1 1  311      11 23 2  2 4        $
F  Zinaida                                        153    21         34754  3          $
F  Zina<i/>da                                      4                                  $
?  Zi+Nan                                                                      1      $
M  Zinautas                                         1                                 $
F  Zinayda                                                             4              $
F  Zinca                                                 2                            $
F  Zincuta                                               1                            $
M  Zinedine                                                                  1        $
?  Zi+Neng                                                                     1      $
F  Zineta                                                  4                          $
M  Zini                                                           3                   $
F  Zinica                                                1                            $
?  Zi+Ning                                                                     1      $
M  Zino                          1                                                    $
M  Zinon                                          1                                   $
F  Zinovia                                        1      1         1                  $
M  Zinovie                                               1            2               $
M  Zinovii                                                             1              $
F  Zinta                                           4                                  $
M  Zintis                                          3                                  $
M  Zion                                                                       4       $
F  Zipi                                                                       2       $
?  Zi+Ping                                                                     1      $
F  Zipora                                                                     6       $
F  Zippora                                                                    6       $
?  Zi+Rong                                                                     2      $
F  Zi<s,>an                                                                 1         $
?  Zi+Shu                                                                      1      $
F  Ziska                                    1                                         $
=  Ziska Franziska                          1                                         $
?F Zissel                                                                     2       $
M  Zissis                                                          1                  $
F  Zita                          2 2  1   133 2    57 1562  2                         $
?  Zi+Tao                                                                      1      $
M  Ziv                                                                        6       $
F  Ziva                                                                       5       $
F  <Z^>ivana                                                1  15                     $
F  Ziver                                                                    2         $
F  <Z^>ivil<e°>                                     3                                 $
F  <Z^>ivka                                                   666                     $
M  <Z^>ivotije                                                  1                     $
F  Ziwar                                                                     2        $
?  Zi+Wei                                                                      2      $
?  Zi+Wen                                                                      1      $
?  Zi+Xi                                                                       1      $
?  Zi+Xin                                                                      1      $
?  Zi+Xing                                                                     1      $
M  Ziya                                                                  2  4         $
M  Ziyad                                                                     4        $
M  Ziyaettin                                                                1         $
F  Zizica                                                1                            $
=  Zizi Zoia                                             1                            $
F  Zlata                                              45  456  452            1       $
M  Zlatan                                                 153  224                    $
M  Zlatomir                                                    34                     $
F  Zlatu<sch>e               +                        1                               $
F  Zlatuše                   -                        1                               $
F  Zlatu<sh>e                +                        1                               $
M  Zoárd                                                1                             $
F  Zoe                        4121          1            4                            $
F  Zoé                               23     1                                         $
F  Zoë                                      1                                         $
F  Zoea                                                  2                            $
F  Zöhre                     +                                              4         $
M  Zoeke                                 1                                            $
F  Zoey                         1                                                     $
F  Zofia                                             8                                $
F  <Z^>ofia                                            4                              $
F  <Z^>ofie                                           4                               $
F  Zofija                                           7            3                    $
F  Zoltánné                                             6                             $
M  Zyber                                                          3                   $
M  Zydi                                                           2                   $
F  <Z^>ydr<e°>                                      1                                 $
F  <Z^>ydron<e°>                                    1                                 $
M  <Z^>ydr<u/>nas                                   5                                 $
M  <Z^>ygantas                                      1                                 $
M  Zygfryd                                           1                                $
M  <Z^>ygimantas                                    2                                 $
M  <Z^>ygintas                                      1                                 $
M  Zygmunt                                           6                                $
M  Zyhdi                                                          2                   $
F  Zyhra                                                     3    3                   $
F  Zyhrie                                                    1                        $
F  Zylfie                                                    1                        $
F  Zyra                                                           3                   $
F  Zyrafete                                                  5                        $
F  Zyrie                                                     1                        $
F  Zyrjeta                                                   1                        $
F  Zyta                                              2                                $

Code snippet:

Select-String -Path .\names_dict_master.txt -Pattern '^(?<SEX>\S+)\s+(?<Name>.+?)\s{2,}' -Encoding oem |
Select-Object -ExpandProperty Matches |
ForEach-Object {
    [PSCustomObject]@{
        Sex  = ($_.Groups | Where-Object Name -EQ Sex).Value.Trim()
        Name = ($_.Groups | Where-Object Name -EQ Name).Value.Trim()
    }
}

Output:

Sex Name
--- ----
M   Aad
M   Aadam
F   Aadje
M   Ådne
M   Aadu
?F  Aaf
F   Aafke
?   Aafke
M   Åge
F   Aagje
F   Aagot
F   Ågot
F   Aagoth
F   Ågoth
M   Åke
M   Aalbert
M   Aarón
M   Aarre
M   Aarron
F   Åsa
F   Aase
F   Åse
M   Åsgeir
F   Aashild
F   Åshild
F   Åslaug
M   Åsmund
F   Åste
M   Aat
M   Abdallah
M   Abdal+Salam
M   Abdel
M   Abdel+Aziz
M   Abdel+Fattah
M   Abdel+Ghani
M   Abder+Razak
M   Abdeslam
M   Abdu
M   Abdülhalim
M   Abdülhamid
M   Abdülkadir
M   Abdülkerim
M   Abdülsamet
M   Abdul+Sattar
M   Abdur+Rahman
M   Abdyl
M   Abe
=   Abe Abraham
M   Abed
F   Abeda
M   Afzal
F   Aga
=   Aga Agnieszka
F   Agaat
F   Agetina
M   Agge
M   Aggeo
F   Aggie
M   Cimdins
F   Çimen
F   Cina
M   Ç<i>nar
F   Cinda
F   Cindi
F   Cindie
F   Cindij
F   Cindy
M   Ciríaco
M   Ciril
M   <C´>iril
F   Cirila
M   Cirillo
M   <C´>irilo
F   Cirina
?M  Clair
F   Claire
?F  Clare
F   Cläre
M   Clarence
F   Claretta
M   Clariano
F   Clarita
F   Clari<t,>a
M   Clark
M   Cleveland
M   Cliff
=   Cliff Clifford
M   Clifford
F   Clíodhna
F   Clíona
M   Clirim
F   Clita
F   Kayoko
M   Kays
M   Kazbek
F   Kaz<e°>
M   Kazem
M   Kazi
=   Kazik Kazimierz
M   Kazim
M   Kaz<i>m
F   Kazimiera
M   Ka<z^>imir
M   Kazimír
M   Kázmér
M   Kazuaki
M   Kazuhiro
M   Tešo
F   Tess
F   Tessa
M   Tesse
?   Yi+Ming
?   Yin
?   Ying+Bin
?   Ying+Bing
?   Ying+Da
?   Ying+Di
?   Ying+Fu
?   Ying+Gang
?   Zhi+Quan
?   Zhi+Sheng
?   Zhi+Shun
?   Zhi+Song
F   Zhivka
M   Zhivko
?   Zhi+Wang
?   Zhi+Wei
?   Zhi+Wen
?   Zhi+Wu
?   Zhi+Xia
?   Zhi+Xian
?   Zhi+Xiang
?   Zhong+Lin
?   Zhong+Ling
?   Zhong+Long
F   Zhoresa
M   Zhoro
M   Zhorzh
F   Zhorzheta
?   Zhou
?   Zhou+Hong
?   Zhou+Ping
?   Zhu
?   Zhu+An
?   Zhuang
?   Zhuang+Zhi
?   Zhu+Chuan
?   Zhu+Gang
?   Zhu+Guo
?   Zhu+Hong
?   Zhu+Jin
?   Zhu+Jun
?   Zhuo+Xi
?   Zhuo+Xuan
?   Zhu+Ping
?   Zhu+Qin
?   Zhu+Qing
?   Zhu+Xian
?   Zhu+Ying
?   Zhu+Yu
?   Zi
M   Zia
?   Zi+Kun
F   Zila
?   Zi+Lai
F   Zilha
?   Zi+Li
F   Zília
?   Zi+Liang
?   Zi+Ling
F   Zilli
?   Zi+Long
?   Zi+Lu
M   <Z^>ilvinas
?   Zi+Mei
?   Zi+Mian
?   Zi+Min
?   Zi+Ming
F   Zina
F   Zinaida
F   Zina<i/>da
?   Zi+Nan
M   Zinautas
F   Zinayda
F   Zinca
F   Zincuta
M   Zinedine
?   Zi+Neng
F   Zineta
M   Zini
F   Zinica
?   Zi+Ning
M   Zino
M   Zinon
F   Zinovia
M   Zinovie
M   Zinovii
F   Zinta
M   Zintis
M   Zion
F   Zipi
?   Zi+Ping
F   Zipora
F   Zippora
?   Zi+Rong
F   Zi<s,>an
?   Zi+Shu
F   Ziska
=   Ziska Franziska
?F  Zissel
M   Zissis
F   Zita
?   Zi+Tao
M   Ziv
F   Ziva
F   <Z^>ivana
F   Ziver
F   <Z^>ivil<e°>
F   <Z^>ivka
M   <Z^>ivotije
F   Ziwar
?   Zi+Wei
?   Zi+Wen
?   Zi+Xi
?   Zi+Xin
?   Zi+Xing
M   Ziya
M   Ziyad
M   Ziyaettin
F   Zizica
=   Zizi Zoia
F   Zlata
M   Zlatan
M   Zlatomir
F   Zlatu<sch>e
F   Zlatuše
F   Zlatu<sh>e
M   Zoárd
F   Zoe
F   Zoé
F   Zoë
F   Zoea
F   Zöhre
M   Zoeke
F   Zoey
F   Zofia
F   <Z^>ofia
F   <Z^>ofie
F   Zofija
F   Zoltánné
M   Zyber
M   Zydi
F   <Z^>ydr<e°>
F   <Z^>ydron<e°>
M   <Z^>ydr<u/>nas
M   <Z^>ygantas
M   Zygfryd
M   <Z^>ygimantas
M   <Z^>ygintas
M   Zygmunt
M   Zyhdi
F   Zyhra
F   Zyhrie
F   Zylfie
F   Zyra
F   Zyrafete
F   Zyrie
F   Zyrjeta
F   Zyta

The special characters are still there and even the nicknames marked with the equal sign are there.

1 Like

Thank you, I didn’t realise that you could actually share regex101, somehow I missed the click + save. regex101: build, test, and debug regex, I was able to test it here.

Will use the template you showed below next time if I ask another question (probably will since I plan on practicing with more fields), again my apologies. I also checked the file (I tried ctrl+f to find Kathy Katherine), couldn’t find it, scrolled down, found it, so that works.

Thank you again for your help, I appreciate it, on reflection I think I was trying to find incorrect patterns and instead should’ve been looking for whitespaces like you were.

Final commandlet:

Select-String -Path "C:\Users\accol\Desktop\name_dict_master.txt" -Pattern '^(?<SEX>\S+)\s+(?<Name>.+?)\s{2,}' |
Select-Object -ExpandProperty Matches |
ForEach-Object {
    [PSCustomObject]@{
        Sex  = ($_.Groups | Where-Object Name -EQ Sex).Value.Trim()
        Name = ($_.Groups | Where-Object Name -EQ Name).Value.Trim()
    }
} | Export-Csv -Path .\names_dict_master_powershell.csv -Delimiter ',' -NoTypeInformation -Encoding UTF8