Concatenating multiple text files into a single file in Bash

前端 未结 12 1624
眼角桃花
眼角桃花 2020-11-29 15:31

What is the quickest and most pragmatic way to combine all *.txt file in a directory into one large text file?

Currently I\'m using windows with cygwin so I have acc

12条回答
  •  天涯浪人
    2020-11-29 16:04

    Just remember, for all the solutions given so far, the shell decides the order in which the files are concatenated. For Bash, IIRC, that's alphabetical order. If the order is important, you should either name the files appropriately (01file.txt, 02file.txt, etc...) or specify each file in the order you want it concatenated.

    $ cat file1 file2 file3 file4 file5 file6 > out.txt
    

提交回复
热议问题