spread a file into multiple .csv files per each line of inputfile read

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

1 Answer

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

0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like