I have n files and I am using cat to combine them in to one.
Before that simply add the name of the output file to 4th column and then print the output. Is it possible ?
input1
chr start end name 0 + key
input2
chr start end name 0 + key
inputn
chr start end name 0 + key
print a column with the name of the output file
chr start end name_input1 0 + key
chr start end name_input2 0 + key
chr start end name_inputn 0 + key