Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Concatenating several files in order


    Hi, I currently have about 60 files in a directory, and I need to concatenate them in order. They have names such as:

    OBS_DOMAIN101
    OBS_DOMAIN102
    OBS_DOMAIN103
    ....

    If I were to just do a simple:

    cat OBS_DOMAIN* > output.txt

    would this concatenate them all in the order they are listed? If not, how would I do this fairly easily?

    Thanks.

  2. #2
    Yes, that cat command should expand the files in alphabetical order. Just bear in mind that it would be in the same order as
    Code:
    ls OBS_DOMAIN*
    because it is the shell expansion that is the consistent piece.

    You could also do:

    Code:
    sort OBS_DOMAIN*

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •