reformat text in a file to another direction

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












I have table in the current format:



Lead:Arrow1:Arrow2:Arrow3
Follow:Arrow4:Arrow5:Arrow6:Arrow7:Arrow8:Arrow9


I want to turn this to the



Lead:
Arrow1
Arrow2
Arrow3
Follow
Arrow4
Arrow5
Arrow6
Arrow7
Arrow8
Arrow9


i tried awk



$(awk -F":" '/Lead/ print NF-1' $f)
$(awk -F":" '/Follow/ print NF-1' $f)


but didn't work how can I do it in awk or any other method?










share|improve this question









New contributor




kashef is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • Possible duplicate of Print each field of CSV on newline without knowing number of fields
    – Î±Ò“sнιη
    22 mins ago














up vote
2
down vote

favorite












I have table in the current format:



Lead:Arrow1:Arrow2:Arrow3
Follow:Arrow4:Arrow5:Arrow6:Arrow7:Arrow8:Arrow9


I want to turn this to the



Lead:
Arrow1
Arrow2
Arrow3
Follow
Arrow4
Arrow5
Arrow6
Arrow7
Arrow8
Arrow9


i tried awk



$(awk -F":" '/Lead/ print NF-1' $f)
$(awk -F":" '/Follow/ print NF-1' $f)


but didn't work how can I do it in awk or any other method?










share|improve this question









New contributor




kashef is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • Possible duplicate of Print each field of CSV on newline without knowing number of fields
    – Î±Ò“sнιη
    22 mins ago












up vote
2
down vote

favorite









up vote
2
down vote

favorite











I have table in the current format:



Lead:Arrow1:Arrow2:Arrow3
Follow:Arrow4:Arrow5:Arrow6:Arrow7:Arrow8:Arrow9


I want to turn this to the



Lead:
Arrow1
Arrow2
Arrow3
Follow
Arrow4
Arrow5
Arrow6
Arrow7
Arrow8
Arrow9


i tried awk



$(awk -F":" '/Lead/ print NF-1' $f)
$(awk -F":" '/Follow/ print NF-1' $f)


but didn't work how can I do it in awk or any other method?










share|improve this question









New contributor




kashef is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I have table in the current format:



Lead:Arrow1:Arrow2:Arrow3
Follow:Arrow4:Arrow5:Arrow6:Arrow7:Arrow8:Arrow9


I want to turn this to the



Lead:
Arrow1
Arrow2
Arrow3
Follow
Arrow4
Arrow5
Arrow6
Arrow7
Arrow8
Arrow9


i tried awk



$(awk -F":" '/Lead/ print NF-1' $f)
$(awk -F":" '/Follow/ print NF-1' $f)


but didn't work how can I do it in awk or any other method?







awk text-formatting






share|improve this question









New contributor




kashef is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




kashef is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 28 mins ago









Jeff Schaller

33.7k851113




33.7k851113






New contributor




kashef is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 37 mins ago









kashef

132




132




New contributor




kashef is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





kashef is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






kashef is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











  • Possible duplicate of Print each field of CSV on newline without knowing number of fields
    – Î±Ò“sнιη
    22 mins ago
















  • Possible duplicate of Print each field of CSV on newline without knowing number of fields
    – Î±Ò“sнιη
    22 mins ago















Possible duplicate of Print each field of CSV on newline without knowing number of fields
– Î±Ò“sнιη
22 mins ago




Possible duplicate of Print each field of CSV on newline without knowing number of fields
– Î±Ò“sнιη
22 mins ago










1 Answer
1






active

oldest

votes

















up vote
4
down vote



accepted










You can use tr as follows:



<file tr ":" "n"

Lead
Arrow1
Arrow2
Arrow3
Follow
Arrow4
Arrow5
Arrow6
Arrow7
Arrow8
Arrow9


or awk as follows:



<file awk 'gsub(/:/,"n")1'
Lead
Arrow1
Arrow2
Arrow3
Follow
Arrow4
Arrow5
Arrow6
Arrow7
Arrow8
Arrow9





share|improve this answer






















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );






    kashef is a new contributor. Be nice, and check out our Code of Conduct.









     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f474240%2freformat-text-in-a-file-to-another-direction%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    4
    down vote



    accepted










    You can use tr as follows:



    <file tr ":" "n"

    Lead
    Arrow1
    Arrow2
    Arrow3
    Follow
    Arrow4
    Arrow5
    Arrow6
    Arrow7
    Arrow8
    Arrow9


    or awk as follows:



    <file awk 'gsub(/:/,"n")1'
    Lead
    Arrow1
    Arrow2
    Arrow3
    Follow
    Arrow4
    Arrow5
    Arrow6
    Arrow7
    Arrow8
    Arrow9





    share|improve this answer


























      up vote
      4
      down vote



      accepted










      You can use tr as follows:



      <file tr ":" "n"

      Lead
      Arrow1
      Arrow2
      Arrow3
      Follow
      Arrow4
      Arrow5
      Arrow6
      Arrow7
      Arrow8
      Arrow9


      or awk as follows:



      <file awk 'gsub(/:/,"n")1'
      Lead
      Arrow1
      Arrow2
      Arrow3
      Follow
      Arrow4
      Arrow5
      Arrow6
      Arrow7
      Arrow8
      Arrow9





      share|improve this answer
























        up vote
        4
        down vote



        accepted







        up vote
        4
        down vote



        accepted






        You can use tr as follows:



        <file tr ":" "n"

        Lead
        Arrow1
        Arrow2
        Arrow3
        Follow
        Arrow4
        Arrow5
        Arrow6
        Arrow7
        Arrow8
        Arrow9


        or awk as follows:



        <file awk 'gsub(/:/,"n")1'
        Lead
        Arrow1
        Arrow2
        Arrow3
        Follow
        Arrow4
        Arrow5
        Arrow6
        Arrow7
        Arrow8
        Arrow9





        share|improve this answer














        You can use tr as follows:



        <file tr ":" "n"

        Lead
        Arrow1
        Arrow2
        Arrow3
        Follow
        Arrow4
        Arrow5
        Arrow6
        Arrow7
        Arrow8
        Arrow9


        or awk as follows:



        <file awk 'gsub(/:/,"n")1'
        Lead
        Arrow1
        Arrow2
        Arrow3
        Follow
        Arrow4
        Arrow5
        Arrow6
        Arrow7
        Arrow8
        Arrow9






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 23 mins ago

























        answered 35 mins ago









        Goro

        7,83453472




        7,83453472




















            kashef is a new contributor. Be nice, and check out our Code of Conduct.









             

            draft saved


            draft discarded


















            kashef is a new contributor. Be nice, and check out our Code of Conduct.












            kashef is a new contributor. Be nice, and check out our Code of Conduct.











            kashef is a new contributor. Be nice, and check out our Code of Conduct.













             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f474240%2freformat-text-in-a-file-to-another-direction%23new-answer', 'question_page');

            );

            Post as a guest













































































            Comments

            Popular posts from this blog

            What does second last employer means? [closed]

            List of Gilmore Girls characters

            One-line joke