fullfile.csv:

```
animal,number
rabbit,1
fish,2
mouse,1
dog,1
lizard,2
cat,2

```

And I want to split the file on the value in the second column,
and used this command:

```
awk 'BEGIN {FS = ","}; {print > ("file"$2".csv")}' fullfile.csv

```

Outputs:

file1.csv

```
rabbit,1
mouse,1
dog,1

```

file2.csv

```
fish,2
lizard,2
cat,2

```

However there is no header in file1.csv or file2.csv so I tried to add it like so:

```
awk 'BEGIN {FS = ","}; NR==1 { print } {print > ("file"$2".csv")}' fullfile.csv

```

But the header prints to the command line instead of going to each file. How do I get the header to be included in each file?