Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8840809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:33:05+00:00 2026-06-14T10:33:05+00:00

Given files named 1.csv, 2.csv, 3.csv, …89.csv… n.csv how do I append them together

  • 0

Given files named 1.csv, 2.csv, 3.csv, …89.csv… n.csv
how do I append them together in numeric order)(1 to n) in bash shell script?
is there a one-liner for the solution?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T10:33:06+00:00Added an answer on June 14, 2026 at 10:33 am

    If your files where named with leading zeros, it would be easier, i.e.

      cat [0-9].csv [0-9][0-9].csv .... > new.csv
    

    But its not too hard to get a true numeric order, given

    ls -1
    1
    10
    11
    12
    13
    2
    20
    21
    3
    7
    8
    9
    

    (in both samples, note that the option to ls is the number one, (1), not the letter L (l))

    AND

    ls -1 [0-9]* | sort -n
    1
    2
    3
    7
    8
    9
    10
    11
    12
    13
    20
    21
    

    THEN

      cat $( ls -1 *.csv | sort -n  ) > new.csv
    

    Assuming all your csv files are numbered.

    If you have more than 1000 files, file arg processing in the shell may break down, and you should post a new question for correct use of xargs.

    To see what is happening add shell debugging/trace use

     set -vx  # to turn on
     set +vx  # to turn it off
    

    .

    IHTH.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to know the files a given process is reading/writing. Is there a
I'm trying to write a bash script which will, given the name of a
Is there a default/official/recommended way to parse CSV files in C#? I don't want
I want to delete all files in a directory with a given name, except
I was given MATLAB figure files with four subplots. The last subplot has two
I'm tring to create an SSIS package to import some dataset files, however given
Does anyone here know of any quick, clean way to convert csv files to
I'm trying to create a function to create csv files from queries. After I
I am trying to parse a csv file where my data is given in
I have an SSIS package that transfers some tables to CSV files on a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.