I have to put in a bash variable the first line of a file. I guess it is with the grep command, but it is any way to restrict the number of lines?
Just echo the first list of your source file into your target file.
echo
echo $(head -n 1 source.txt) > target.txt