Shell script UNIX to read text file line by line

i have a text file as belows, it includes 2 columns, 1st is the column name, 2nd is the file_name

data_file.txt

column_name file_name
col1               file1
col2               file2
col3               file1
col4               file1
col5               file2

now, i would like to output below result to a text file, which returns all the column name by file name as below.

file_name   column_name
file1           col1,col3,col4
file2           col2,col5

how can i write a shell script to read the data_file.txt line by line and output the result as above by file name.

perl -lane 'if($. == 1){ print "$F[1] $F[0]" and next } push @{$f{$F[1]}}, $F[0]; END{ $"=","; for(sort keys %f){print "$_ @{$f{$_}}"}}' data_file.txt
file_name column_name
file1 col1,col3,col4
file2 col2,col5

my data_file is changing.. how can I transform to return file_name per line and concat all the column_name to that file, so that each line has 1 file name.

I am sorry for not understanding. Is not that what it does, already? Please, post another, more exact, example if that's not what you want.

How about

{ head -1 ; tail -n+1 |  sort -k2 -k1.1; } < file2 | awk '
$2 != L2        {printf "%c%s ", LF, $2
                 LF = "\n"
                 DL = ""
                 L2 = $2
                }
                {printf "%c%s", DL, $1
                 DL = ","
                }
END             {print ""
                }
'
file_name column_name
file1 col1,col3,col4
file2 col2,col5