I\'m trying to add a line at the beginning of a file, using
echo \'time/F:x1:x2\' | cat - file.txt>newfile.txt
But this produces line breaks
Use -n to disable the trailing newline:
-n
echo -n 'time/F:x1:x2' | cat - file.txt > newfile.txt
There are other ways, too:
sed '1s|^|time/F:x1:x2|' file.txt > newfile.txt