I have .csv file with over 1000 rows that contains on each row a number ie, "2224441214" that is the only value on the row. I need to break that file up into a .csv file named "2224441214.csv" for each row.

ie, "2224441214.csv" "22655443.csv" "2222211564.csv"

  • 2
    Could you edit your question to provide a few verbatim rows from your input so we can see what you're actually dealing with? It's not clear where this these row numbers actually are. – Oli Nov 3 '16 at 15:52
  • Its rather simple, Each row has 1 column with a number. I just need a .csv file for each number in the cell... 2277933696 2278001130 2278025610 2278206304 2278984216 2280632844 2282153588 2283260326 2283541669 10000009194 10000010217 is what is would look like when you open it. If it is opened in a spreadsheet it is only column a – J Free Nov 3 '16 at 16:01

It can be done with below awk command,

awk '{print > $0".csv"}' infile.csv

This will create multi .csv files named with numbers read from infile.csv


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.