1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Merging+grouping two text files based on partial file name match?

Discussion in 'General Scripting Chat' started by Capo Dei Capi, Jan 24, 2016.

  1. Capo Dei Capi

    Capo Dei Capi BANNED BANNED

    Joined:
    Oct 23, 2014
    Messages:
    754
    Likes Received:
    7,211
    Is there any script that can merge two text files and group the lines together based on partial name matches? I've been looking for scripts online for a while but can't find one that is merging+grouping for partial name matches

    For example I have a folder with links with _s at the end and one with .ts at the end, Is it possible to merge and group together based on the 5 letter code before _s and .ts

     
  2. Repulsor

    Repulsor Power Member

    Joined:
    Jun 11, 2013
    Messages:
    774
    Likes Received:
    280
    Location:
    PHP Scripting ;)
    From your example, I can see a simple sort would give you the expected result. Get lines from both files, make them as an array, sort alphabetically and numerically and you will get what you have listed in the example. Just taking a wild guess.

    If you got some bucks to pop, get to me over skype, and I will see what I can do.
     
    • Thanks Thanks x 1
  3. Capo Dei Capi

    Capo Dei Capi BANNED BANNED

    Joined:
    Oct 23, 2014
    Messages:
    754
    Likes Received:
    7,211
    I think awk may be able to do it I just need to read up on it and experiment by changing around some scripts that do something similar.
     
    • Thanks Thanks x 2