I have a file (file.csv) which looks like this:
abc 123
abc 001
abc 014
bos 011
bos 034
bos 079
bos 004
...
PS: column 1 of file.csv has 27297 unique words in total, and file.csv has 789234 rows in total
I want to split it into multiple files basing on the first column. and I use awk to deal with it:
awk '{x=++i}{print $2 > "HG"x".txt"}' file.csv
however, the name of the output was HG1.txt, HG2.txt,..., HG27297.txt
. what I want is that the file name of output should be formated, they should look like HG000001.txt, HG000002.txt,..., HG027297.txt
.