Purchase Linux CDs / DVDs / Flash Drives at OSDisc.com

Welcome to Our Community

While Linux.org has been around for a while, we recently changed management and had to purge most of the content (including users). If you signed up before April 23rd please sign up again. Thanks!

Massaging text files

Discussion in 'Getting Started' started by lvirden, Oct 12, 2017.

  1. lvirden

    lvirden New Member

    Joined:
    Oct 6, 2017
    Messages:
    5
    Likes Received:
    0
    I have a file with this format:
    Code:
    Title 1
    - Character Name
    - Character Name2
    - CharacterB Name3
    Title 2
    - Character Name2
    Title 3
    - CharacterC Name4
    
    and what I would like to end up with is a file like this:
    Character Name,Title 1
    Character Name 2,Title 1,Title 2
    CharacterB Name 3,Title 1
    CharacterC Name4,Title 3
    
    I am trying to figure out how to transform the first file into the second just using standard Unix/Linux type filters, but I am afraid there isn't a simple way to do that.



    Is there perhaps some kind of pipeline set of filters that would perform this type of transformation?
     

Share This Page