how can I provide files as inputs to `tsort`? [on hold]











up vote
-2
down vote

favorite












The input to tsort can be provided as in this example:



$ tsort <<EOF
a b c
b c d e
EOF


If I have two files as inputs instead,



a
b
c


and



b
c
d
e


how can I provide the two files in bash as inputs to tsort ? Thanks.










share|improve this question













put on hold as unclear what you're asking by muru, Thomas, mosvy, Isaac, RalfFriedl 2 days ago


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.



















    up vote
    -2
    down vote

    favorite












    The input to tsort can be provided as in this example:



    $ tsort <<EOF
    a b c
    b c d e
    EOF


    If I have two files as inputs instead,



    a
    b
    c


    and



    b
    c
    d
    e


    how can I provide the two files in bash as inputs to tsort ? Thanks.










    share|improve this question













    put on hold as unclear what you're asking by muru, Thomas, mosvy, Isaac, RalfFriedl 2 days ago


    Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

















      up vote
      -2
      down vote

      favorite









      up vote
      -2
      down vote

      favorite











      The input to tsort can be provided as in this example:



      $ tsort <<EOF
      a b c
      b c d e
      EOF


      If I have two files as inputs instead,



      a
      b
      c


      and



      b
      c
      d
      e


      how can I provide the two files in bash as inputs to tsort ? Thanks.










      share|improve this question













      The input to tsort can be provided as in this example:



      $ tsort <<EOF
      a b c
      b c d e
      EOF


      If I have two files as inputs instead,



      a
      b
      c


      and



      b
      c
      d
      e


      how can I provide the two files in bash as inputs to tsort ? Thanks.







      coreutils tsort






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 2 days ago









      Tim

      1




      1




      put on hold as unclear what you're asking by muru, Thomas, mosvy, Isaac, RalfFriedl 2 days ago


      Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






      put on hold as unclear what you're asking by muru, Thomas, mosvy, Isaac, RalfFriedl 2 days ago


      Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote













          You need to put all entries of each file into a single line.



          You can do so with an unquoted $(...) which will split on whitespace (and that includes newline) and then you can use echo on it to print the arguments into a single line.



          This should work:



          { echo $(cat file1)
          echo $(cat file2)
          } | tsort


          This should produce the same output as your example does.





          UPDATE: The input of tsort is broken on any whitespace, so preserving each file's contents in a single line isn't really important.



          In that case, this should be enough:



          cat file1 file2 | tsort


          Though in your example, you don't really have a number of pairs, there is an odd number of items in your file1. As you noticed already, that is a problem for tsort.






          share|improve this answer






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            1
            down vote













            You need to put all entries of each file into a single line.



            You can do so with an unquoted $(...) which will split on whitespace (and that includes newline) and then you can use echo on it to print the arguments into a single line.



            This should work:



            { echo $(cat file1)
            echo $(cat file2)
            } | tsort


            This should produce the same output as your example does.





            UPDATE: The input of tsort is broken on any whitespace, so preserving each file's contents in a single line isn't really important.



            In that case, this should be enough:



            cat file1 file2 | tsort


            Though in your example, you don't really have a number of pairs, there is an odd number of items in your file1. As you noticed already, that is a problem for tsort.






            share|improve this answer



























              up vote
              1
              down vote













              You need to put all entries of each file into a single line.



              You can do so with an unquoted $(...) which will split on whitespace (and that includes newline) and then you can use echo on it to print the arguments into a single line.



              This should work:



              { echo $(cat file1)
              echo $(cat file2)
              } | tsort


              This should produce the same output as your example does.





              UPDATE: The input of tsort is broken on any whitespace, so preserving each file's contents in a single line isn't really important.



              In that case, this should be enough:



              cat file1 file2 | tsort


              Though in your example, you don't really have a number of pairs, there is an odd number of items in your file1. As you noticed already, that is a problem for tsort.






              share|improve this answer

























                up vote
                1
                down vote










                up vote
                1
                down vote









                You need to put all entries of each file into a single line.



                You can do so with an unquoted $(...) which will split on whitespace (and that includes newline) and then you can use echo on it to print the arguments into a single line.



                This should work:



                { echo $(cat file1)
                echo $(cat file2)
                } | tsort


                This should produce the same output as your example does.





                UPDATE: The input of tsort is broken on any whitespace, so preserving each file's contents in a single line isn't really important.



                In that case, this should be enough:



                cat file1 file2 | tsort


                Though in your example, you don't really have a number of pairs, there is an odd number of items in your file1. As you noticed already, that is a problem for tsort.






                share|improve this answer














                You need to put all entries of each file into a single line.



                You can do so with an unquoted $(...) which will split on whitespace (and that includes newline) and then you can use echo on it to print the arguments into a single line.



                This should work:



                { echo $(cat file1)
                echo $(cat file2)
                } | tsort


                This should produce the same output as your example does.





                UPDATE: The input of tsort is broken on any whitespace, so preserving each file's contents in a single line isn't really important.



                In that case, this should be enough:



                cat file1 file2 | tsort


                Though in your example, you don't really have a number of pairs, there is an odd number of items in your file1. As you noticed already, that is a problem for tsort.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 2 days ago

























                answered 2 days ago









                Filipe Brandenburger

                6,1041625




                6,1041625















                    Popular posts from this blog

                    サソリ

                    広島県道265号伴広島線

                    Setup Asymptote in Texstudio