Monday, April 25, 2011

Unable to put a .txt -file to the end of another .txt -file

How can I put .Txt file A at the end of .Txt file B in terminal without opening the files?

From stackoverflow
  • Do you mean without opening them in an editor? Use cat:

    cat A >> B
    

    The >> redirects the output of the cat command (which output file A) to the file B. But instead of overwriting contents of B, it appends to it. If you use a single >, it will instead overwrite any previous content in B.

  • cat A >> B
    

    Should do it. Not sure what you mean by "not opening", of course the files must be opened, in the operating system sense of the word, for this to happen.

    The double arrow is "append".

  • Isn't it trivial?

    cat A >> B
    
    Alex Reynolds : If it was trivial, the question wouldn't be asked.
    Alex Reynolds : -1. We're here to answer questions and help people, not cast aspersions. Get the chip off your shoulder.
    Judge Maygarden : Who has the chip on their shoulder?
  • I am not sure what you mean by "opening the files", but

    $ cat a.txt >> b.txt

    should do the trick.

0 comments:

Post a Comment