I have many files in a folder named as:
ctg_1.fasta
lcd2_13.fasta
..
etc (all of them are .fasta)
I want to change the first line of each them to include the following: >ctg_1, >lcd2_13. I mean, that each file has its own name as the first line.
I think the command sed would help me. I tried to execute this:
var=">ctg_1"
sed -i "1s/.*/$var/" ctg_1.fasta
And it works, but I would like to do it recursively and that each file includes its own name.
Do you have any idea about how can I achieve this?