Help Searching for code using Github - I have searched Experts Exchange and not found any suitable information

My computer operating system is Windows 7 pro .  

I am trying unsuccessfully to find code in Github.  I need help using the search feature.  Yes, I have searched Experts-Exchange first before posting this message.  I guess I just don’t know what key words to enter.

I have to write a program to switch last name, first name to first name, last name.  I am not a coding expert.  I was hoping to find some vbscript code which would perform the task.  I have to deal with all kinds of names.  In the data I have to convert  there are names with 3 elements like:

Joe Jones Hopkins

Then there are people who have just one name.  
And there are people with suffixes like Jr and III .  Example Joe Jones jr.  etc.

Please explain in detail how you would use Github search to find suitable code to do the above.  I would prefer vbscript but Python code would be suitable also.

Or may be there is an Experts-Exchange article which would help.

Thank you for your help.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

yo_beeDirector of Information TechnologyCommented:
Is the data just a text file or does it have separates?

Your question lacks details about the data format.
bbaoIT ConsultantCommented:
what’s the source format for the last ans first names? is every full name in a single string field?
donpickAuthor Commented:
The names are in a print file.  I have attached a sample print file.  
The conversion program has to be used by ordinary users.  They don’t know anything about programming.
I considered importing all the names into Excel but this company does not use Windows products.  Their office software is produced by LibreOffice.  Libreoffice does not have the convenient programming interface as Excel does.

If they were using Windows products I would write a vbscript to import the names into Excel and then the names could be in separate cells and I could just interrogate the cells to see if there is relevant data.  So if the names were put into cells beginning with column A, then if column A, B , C and D had data in them then I’d know I am dealing a name like
  Hastings Commert Sara Jones  
where the last name is Hastings Commert and the first name is Sara.

But I don’t have the luxury of using Excel.  
My thought was to read each character in the name field, determine when a space occurred and put the information into an array.  Then, if one array row had 4 elements in it then I’d know  this array row contained a complex name like the one above.

What other ideas can you think of to determine how to recognize a last and first name in the file I have uploaded?
Active Protection takes the fight to cryptojacking

While there were several headline-grabbing ransomware attacks during in 2017, another big threat started appearing at the same time that didn’t get the same coverage – illicit cryptomining.

Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
I assume you want to extract and process the "Customer NAME" column of the report?

You won't find any turnkey solution by searching, because the code needs to be customized for that particular report format. To properly process, you need to filter for the interesting lines or (better) concat two successive lines to unwind the report's line wraps.

My suggestion is to use either VBScript or PowerShell (preferred) - both are part of the OS, and there is no need to update or install anything.
John TsioumprisSoftware & Systems EngineerCommented:
Based on this article from MS have prepared a very quick and dirty example

Const ForReading = 1
On Error Resume Next
Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objFile = objFSO.OpenTextFile("C:\Temp\NameFile.txt", ForReading)

Do Until objFile.AtEndOfStream

    strLine = objFile.ReadLine

    arrFields = Split(strLine, "    ")
    strName = arrFields(1) &"," & arrFields(2) & " ," & arrFields(3) & "," & arrFields(4) &"," & arrFields(5)& "," & arrFields(6)&"," & arrFields(7)
	msgbox strName


Open in new window

DON'T Try it on a big file...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
donpickAuthor Commented:
Mr.Tsioumpris:   Thank you for your help.  Great idea.
Based on that data sample, the vbscript code isn't going to work..
Now... since the data sample seems to have fixed size fields, then this should work.. BUT.. (huge caveat).. they *must* be fixed size fields, or this will just mangle what you have.. And if they do end up having variable size fields, then segmenting them will be difficult..

$filepath = 'c:\temp\sample.txt'
$OutputFile = 'c:\temp\Updated_Sample.txt'

$OutputData = [System.Collections.ArrayList]::new()

$reader = [System.IO.File]::OpenText($filepath)

while($null -ne ($line = $reader.ReadLine())) {
    if ($line -match '^\s?(\d{6}|\d{5}).*')
        #Data dataline
        $Segment1 = $line.SubString(0,34)
        $Segment2 = $line.SubString(35,16).Trim() #LastName 
        $Segment3 = $line.SubString(51,14).Trim() #First Name
        $Segment4 = $line.SubString(65,1)  #Middle Initial or space
        $Segment5 = $line.SubString(66)

        $NewSegment3 = $Segment3.PadRight(14,' ')
        $NewMiddleSegment = $NewSegment3, $Segment2 -join ''
        $NewMiddleSegment = $NewMiddleSegment.PadRight(31,' ')
        $WriteLine = $Segment1, $NewMiddleSegment, $Segment4, $Segment5 -join ''
        $WriteLine = $line
Set-Content -Path $OutputFile -Value ($OutputData -join "`r`n")

Open in new window

Using your sample data, here is what got output from it:
[RP00151] Recalls                                               Recall List                                         DATE  9/28/2018 
JOHN    LP GRANGER                                                                                                  TIME      11:41 
USER - RENEE                                                                                                        PAGE          1 
PAT REM #    DATE     Cust#          Customer NAME                       PHONE #     REMIND #   REMIND NAME                    CS  
102266   04/01/18    26233        MARIA DEL CARMDEL RIO JAUREGUI      999 999 9999       5     BOX SPRING 2                        0
102271   04/01/18    29172        LUIS          SOTO                  999 999 9999       5     BOX SPRING 2                        0
102272   04/01/18    25671        NAZIR         PAMPLIN               999 999 9999       5     BOX SPRING 2                        0
102273   04/01/18    28392        SEYED         MAHBAZ           A    999 999 9999       5     BOX SPRING 2                        0
102274   04/01/18    28395        IRIS          CIOSI                 999 999 9999       5     BOX SPRING 2                        0
102275   04/01/18    27882        SHERMAN       LIN                   999 999 9999       5     BOX SPRING 2                        0
102276   04/01/18    I11655       VALERIE       FOLEY            E    999 999 9999       5     BOX SPRING 2                        0
102277   04/01/18    28378        ALMA MARIE    HUSO                  999 999 9999       5     BOX SPRING 2                        0
102278   04/01/18    I11610       KELLIE        BLISH            A    999 999 9999       5     BOX SPRING 2                        0
102279   04/01/18    I5550        CAROL         ENGEN            L    999 999 9999       5     BOX SPRING 2                        0
102280   04/01/18    28333        VIDA          MOVAHEDI MOGHADA      999 999 9999       5     BOX SPRING 2                        0
102281   04/01/18    28402        BRANDI        BANKS            N    999 999 9999       5     BOX SPRING 2                        0
102282   04/01/18    23950        MELANIE       HATCH SLINGWINE       999 999 9999       5     BOX SPRING 2                        0
 94382   04/04/18    I12239       JULIANNE      PARSLEY                                  5     BOX SPRING 2                        0
101902   04/01/18    22275        WINI          SEETHARAMAIAHASH      999 999 9999       5     BOX SPRING 2                        0

Open in new window

Just remember.. this is based on fixed size fields, and swapping the first/middle and lastname sections.. If that doesn't meet your requirements, then it'll need to be adjusted.  I'm sure this could be done with vbscript, but that will take some work.  

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows OS

From novice to tech pro — start learning today.